Revision: 12511
Author: [email protected]
Date: Fri Sep 14 05:01:12 2012
Log: Microoptimization to regexps.
Review URL: https://chromiumcodereview.appspot.com/10917260
http://code.google.com/p/v8/source/detail?r=12511
Modified:
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/regexp.js
/branches/bleeding_edge/src/x64/code-stubs-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Aug 28 02:37:41
2012
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Fri Sep 14 05:01:12
2012
@@ -5232,12 +5232,12 @@
// Set FixedArray length.
__ mov(r6, Operand(r5, LSL, kSmiTagSize));
__ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset));
- // Fill contents of fixed-array with the-hole.
- __ mov(r2, Operand(factory->the_hole_value()));
+ // Fill contents of fixed-array with undefined.
+ __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
__ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- // Fill fixed array elements with hole.
+ // Fill fixed array elements with undefined.
// r0: JSArray, tagged.
- // r2: the hole.
+ // r2: undefined.
// r3: Start of elements in FixedArray.
// r5: Number of elements to fill.
Label loop;
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Aug 28 02:37:41
2012
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Fri Sep 14 05:01:12
2012
@@ -4170,15 +4170,15 @@
Immediate(factory->fixed_array_map()));
// Set length.
__ mov(FieldOperand(ebx, FixedArray::kLengthOffset), ecx);
- // Fill contents of fixed-array with the-hole.
+ // Fill contents of fixed-array with undefined.
__ SmiUntag(ecx);
- __ mov(edx, Immediate(factory->the_hole_value()));
+ __ mov(edx, Immediate(factory->undefined_value()));
__ lea(ebx, FieldOperand(ebx, FixedArray::kHeaderSize));
- // Fill fixed array elements with hole.
+ // Fill fixed array elements with undefined.
// eax: JSArray.
// ecx: Number of elements to fill.
// ebx: Start of elements in FixedArray.
- // edx: the hole.
+ // edx: undefined.
Label loop;
__ test(ecx, ecx);
__ bind(&loop);
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Tue Aug 28 02:37:41
2012
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Fri Sep 14 05:01:12
2012
@@ -5405,12 +5405,12 @@
// Set FixedArray length.
__ sll(t2, t1, kSmiTagSize);
__ sw(t2, FieldMemOperand(a3, FixedArray::kLengthOffset));
- // Fill contents of fixed-array with the-hole.
- __ li(a2, Operand(masm->isolate()->factory()->the_hole_value()));
+ // Fill contents of fixed-array with undefined.
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
__ Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- // Fill fixed array elements with hole.
+ // Fill fixed array elements with undefined.
// v0: JSArray, tagged.
- // a2: the hole.
+ // a2: undefined.
// a3: Start of elements in FixedArray.
// t1: Number of elements to fill.
Label loop;
=======================================
--- /branches/bleeding_edge/src/regexp.js Fri May 25 05:32:02 2012
+++ /branches/bleeding_edge/src/regexp.js Fri Sep 14 05:01:12 2012
@@ -140,18 +140,15 @@
var j = REGEXP_FIRST_CAPTURE + 2;
for (var i = 1; i < numResults; i++) {
start = lastMatchInfo[j++];
- end = lastMatchInfo[j++];
- if (end != -1) {
+ if (start != -1) {
+ end = lastMatchInfo[j];
if (start + 1 == end) {
result[i] = %_StringCharAt(s, start);
} else {
result[i] = %_SubString(s, start, end);
}
- } else {
- // Make sure the element is present. Avoid reading the undefined
- // property from the global object since this may change.
- result[i] = void 0;
}
+ j++;
}
return result;
}
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Aug 28 02:37:41
2012
+++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Fri Sep 14 05:01:12
2012
@@ -3235,14 +3235,14 @@
// Set length.
__ Integer32ToSmi(rdx, rbx);
__ movq(FieldOperand(rcx, FixedArray::kLengthOffset), rdx);
- // Fill contents of fixed-array with the-hole.
- __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex);
+ // Fill contents of fixed-array with undefined.
+ __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
__ lea(rcx, FieldOperand(rcx, FixedArray::kHeaderSize));
- // Fill fixed array elements with hole.
+ // Fill fixed array elements with undefined.
// rax: JSArray.
// rbx: Number of elements in array that remains to be filled, as int32.
// rcx: Start of elements in FixedArray.
- // rdx: the hole.
+ // rdx: undefined.
Label loop;
__ testl(rbx, rbx);
__ bind(&loop);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev