Reviewers: danno, Benedikt Meurer, paul.l..., akos.palfi.imgtec,
Description:
MIPS: Refine '[es6] Introduce a dedicated JSIteratorResult type.'
Port 72bc4b5c8a5c4279bcb8b340edbc8aa1c46d75a1
Original commit message:
Use a single JSIteratorResult type for all implementation provided
iterator results (i.e. the String, Array and collection iterators,
and also for generators). This removes one source of unnecessary
polymorphism in for-of loops. It is accomplished by a new intrinsic
%_CreateIterResultObject() that should be used to create iterator
result objects from JavaScript builtins (there's a matching factory
method for C++ code).
Also restructure the %StringIteratorPrototype%.next() and
%ArrayIteratorPrototype%.next() functions to be a bit more friendly
to optimizing compilers.
BUG=
Please review this at https://codereview.chromium.org/1315903005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+14, -14 lines):
M src/full-codegen/mips/full-codegen-mips.cc
M src/full-codegen/mips64/full-codegen-mips64.cc
Index: src/full-codegen/mips/full-codegen-mips.cc
diff --git a/src/full-codegen/mips/full-codegen-mips.cc
b/src/full-codegen/mips/full-codegen-mips.cc
index
e985f440c780d0b099f4d8e94ca4d93a28994076..7764605f8f4bafd619727dd1ab3b8ccfc63f727e
100644
--- a/src/full-codegen/mips/full-codegen-mips.cc
+++ b/src/full-codegen/mips/full-codegen-mips.cc
@@ -2280,8 +2280,9 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool
done) {
__ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
__ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
__ pop(a2);
- __ li(a3, Operand(isolate()->factory()->ToBoolean(done)));
- __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
+ __ LoadRoot(a3,
+ done ? Heap::kTrueValueRootIndex :
Heap::kFalseValueRootIndex);
+ __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex);
__ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
__ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
__ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
@@ -4498,9 +4499,8 @@ void
FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
__ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
__ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
__ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
- __ pop(a3);
- __ pop(a2);
- __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
+ __ Pop(a2, a3);
+ __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex);
__ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
__ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
__ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
Index: src/full-codegen/mips64/full-codegen-mips64.cc
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc
b/src/full-codegen/mips64/full-codegen-mips64.cc
index
bd1fea27d5839113b4bd443066e4eddc0b7e5e6d..154edcd18cc066ea08d5a4de26322726d502cc83
100644
--- a/src/full-codegen/mips64/full-codegen-mips64.cc
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc
@@ -2278,11 +2278,12 @@ void
FullCodeGenerator::EmitCreateIteratorResult(bool done) {
__ ld(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
__ ld(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
__ pop(a2);
- __ li(a3, Operand(isolate()->factory()->ToBoolean(done)));
- __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
+ __ LoadRoot(a3,
+ done ? Heap::kTrueValueRootIndex :
Heap::kFalseValueRootIndex);
+ __ LoadRoot(a4, Heap::kEmptyFixedArrayRootIndex);
__ sd(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
- __ sd(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
- __ sd(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
+ __ sd(a4, FieldMemOperand(v0, JSObject::kPropertiesOffset));
+ __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset));
__ sd(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
__ sd(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
@@ -4502,12 +4503,11 @@ void
FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
__ ld(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
__ ld(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
__ ld(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
- __ pop(a3);
- __ pop(a2);
- __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
+ __ Pop(a2, a3);
+ __ LoadRoot(a4, Heap::kEmptyFixedArrayRootIndex);
__ sd(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
- __ sd(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
- __ sd(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
+ __ sd(a4, FieldMemOperand(v0, JSObject::kPropertiesOffset));
+ __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset));
__ sd(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
__ sd(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.