Commit ac8acab2 authored by Swapnil Gaikwad's avatar Swapnil Gaikwad Committed by Commit Bot

Add GetIterator bytecode to load object[Symbol.iterator] in accumulator

This is the first in a series of changes to reduce the number of
bytecodes generated for the iteration protocol based operations.
The GetIterator bytecode introduced in this change currently loads the
@@iterator symbol from an object that was previously done using the
LdaNamedProperty bytecode. This change uses builtin-based mechanism
that would be extended to perform additional operations in the future
on absorbing the bytecodes associated with the GetIterator operation
from the iteration protocol.

Bug: v8:9489
Change-Id: I83b8b55c27bae8260bf227f355eeca1ba80cd8f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1701852
Commit-Queue: Swapnil Gaikwad <swapnilgaikwad@google.com>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63139}
parent a2b98b60
...@@ -1181,6 +1181,7 @@ extern macro Int32FalseConstant(): bool; ...@@ -1181,6 +1181,7 @@ extern macro Int32FalseConstant(): bool;
extern macro EmptyStringConstant(): EmptyString; extern macro EmptyStringConstant(): EmptyString;
extern macro LengthStringConstant(): String; extern macro LengthStringConstant(): String;
extern macro NanConstant(): NaN; extern macro NanConstant(): NaN;
extern macro IteratorSymbolConstant(): Symbol;
const TheHole: TheHole = TheHoleConstant(); const TheHole: TheHole = TheHoleConstant();
const Null: Null = NullConstant(); const Null: Null = NullConstant();
...@@ -1487,6 +1488,7 @@ extern transitioning builtin HasProperty(implicit context: Context)( ...@@ -1487,6 +1488,7 @@ extern transitioning builtin HasProperty(implicit context: Context)(
Object, Object): Boolean; Object, Object): Boolean;
extern transitioning macro HasProperty_Inline(implicit context: Context)( extern transitioning macro HasProperty_Inline(implicit context: Context)(
JSReceiver, Object): Boolean; JSReceiver, Object): Boolean;
extern builtin LoadIC(Context, Object, Object, Smi, FeedbackVector): Object;
extern macro ThrowRangeError(implicit context: Context)( extern macro ThrowRangeError(implicit context: Context)(
constexpr MessageTemplate): never; constexpr MessageTemplate): never;
...@@ -1855,6 +1857,12 @@ Cast<Number>(o: Object): Number ...@@ -1855,6 +1857,12 @@ Cast<Number>(o: Object): Number
return TaggedToNumber(o) otherwise CastError; return TaggedToNumber(o) otherwise CastError;
} }
Cast<Undefined>(o: Object): Undefined
labels CastError {
if (o != Undefined) goto CastError;
return %RawDownCast<Undefined>(o);
}
macro Cast<A: type>(o: HeapObject): A macro Cast<A: type>(o: HeapObject): A
labels CastError; labels CastError;
...@@ -1869,6 +1877,12 @@ Cast<Null>(o: HeapObject): Null ...@@ -1869,6 +1877,12 @@ Cast<Null>(o: HeapObject): Null
return %RawDownCast<Null>(o); return %RawDownCast<Null>(o);
} }
Cast<Undefined>(o: HeapObject): Undefined
labels CastError {
const o: Object = o;
return Cast<Undefined>(o) otherwise CastError;
}
Cast<FixedArray>(o: HeapObject): FixedArray Cast<FixedArray>(o: HeapObject): FixedArray
labels CastError { labels CastError {
return HeapObjectToFixedArray(o) otherwise CastError; return HeapObjectToFixedArray(o) otherwise CastError;
......
...@@ -41,4 +41,19 @@ namespace iterator { ...@@ -41,4 +41,19 @@ namespace iterator {
Context)(Object, Object); Context)(Object, Object);
extern builtin IterableToListWithSymbolLookup(implicit context: extern builtin IterableToListWithSymbolLookup(implicit context:
Context)(Object); Context)(Object);
transitioning builtin GetIteratorWithFeedback(
context: Context, receiver: Object, feedbackSlot: Smi,
feedback: Undefined | FeedbackVector): Object {
typeswitch (feedback) {
case (Undefined): {
return GetProperty(receiver, IteratorSymbolConstant());
}
case (feedback: FeedbackVector): {
return LoadIC(
context, receiver, IteratorSymbolConstant(), feedbackSlot,
feedback);
}
}
}
} }
...@@ -660,11 +660,13 @@ class StoreGlobalWithVectorDescriptor : public StoreGlobalDescriptor { ...@@ -660,11 +660,13 @@ class StoreGlobalWithVectorDescriptor : public StoreGlobalDescriptor {
class LoadWithVectorDescriptor : public LoadDescriptor { class LoadWithVectorDescriptor : public LoadDescriptor {
public: public:
// TODO(v8:9497): Revert the Machine type for kSlot to the
// TaggedSigned once Torque can emit better call descriptors
DEFINE_PARAMETERS(kReceiver, kName, kSlot, kVector) DEFINE_PARAMETERS(kReceiver, kName, kSlot, kVector)
DEFINE_PARAMETER_TYPES(MachineType::AnyTagged(), // kReceiver DEFINE_PARAMETER_TYPES(MachineType::AnyTagged(), // kReceiver
MachineType::AnyTagged(), // kName MachineType::AnyTagged(), // kName
MachineType::TaggedSigned(), // kSlot MachineType::AnyTagged(), // kSlot
MachineType::AnyTagged()) // kVector MachineType::AnyTagged()) // kVector
DECLARE_DESCRIPTOR(LoadWithVectorDescriptor, LoadDescriptor) DECLARE_DESCRIPTOR(LoadWithVectorDescriptor, LoadDescriptor)
static const Register VectorRegister(); static const Register VectorRegister();
......
...@@ -3287,6 +3287,17 @@ void BytecodeGraphBuilder::VisitForInStep() { ...@@ -3287,6 +3287,17 @@ void BytecodeGraphBuilder::VisitForInStep() {
environment()->BindAccumulator(index, Environment::kAttachFrameState); environment()->BindAccumulator(index, Environment::kAttachFrameState);
} }
void BytecodeGraphBuilder::VisitGetIterator() {
PrepareEagerCheckpoint();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
VectorSlotPair feedback =
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
const Operator* op = javascript()->GetIterator(feedback);
Node* node = NewNode(op, object);
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::VisitSuspendGenerator() { void BytecodeGraphBuilder::VisitSuspendGenerator() {
Node* generator = environment()->LookupRegister( Node* generator = environment()->LookupRegister(
bytecode_iterator().GetRegisterOperand(0)); bytecode_iterator().GetRegisterOperand(0));
......
...@@ -216,6 +216,17 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) { ...@@ -216,6 +216,17 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
} }
} }
void JSGenericLowering::LowerJSGetIterator(Node* node) {
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
const PropertyAccess& p = PropertyAccessOf(node->op());
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
node->InsertInput(zone(), 2, vector);
Callable callable =
Builtins::CallableFor(isolate(), Builtins::kGetIteratorWithFeedback);
ReplaceWithStubCall(node, callable, flags);
}
void JSGenericLowering::LowerJSStoreProperty(Node* node) { void JSGenericLowering::LowerJSStoreProperty(Node* node) {
CallDescriptor::Flags flags = FrameStateFlagForCall(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node);
PropertyAccess const& p = PropertyAccessOf(node->op()); PropertyAccess const& p = PropertyAccessOf(node->op());
......
...@@ -128,6 +128,8 @@ Reduction JSNativeContextSpecialization::Reduce(Node* node) { ...@@ -128,6 +128,8 @@ Reduction JSNativeContextSpecialization::Reduce(Node* node) {
return ReduceJSToObject(node); return ReduceJSToObject(node);
case IrOpcode::kJSToString: case IrOpcode::kJSToString:
return ReduceJSToString(node); return ReduceJSToString(node);
case IrOpcode::kJSGetIterator:
return ReduceJSGetIterator(node);
default: default:
break; break;
} }
...@@ -1073,7 +1075,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -1073,7 +1075,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
node->opcode() == IrOpcode::kJSLoadProperty || node->opcode() == IrOpcode::kJSLoadProperty ||
node->opcode() == IrOpcode::kJSStoreProperty || node->opcode() == IrOpcode::kJSStoreProperty ||
node->opcode() == IrOpcode::kJSStoreNamedOwn || node->opcode() == IrOpcode::kJSStoreNamedOwn ||
node->opcode() == IrOpcode::kJSHasProperty); node->opcode() == IrOpcode::kJSHasProperty ||
node->opcode() == IrOpcode::kJSGetIterator);
Node* receiver = NodeProperties::GetValueInput(node, 0); Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* context = NodeProperties::GetContextInput(node); Node* context = NodeProperties::GetContextInput(node);
Node* frame_state = NodeProperties::GetFrameStateInput(node); Node* frame_state = NodeProperties::GetFrameStateInput(node);
...@@ -1381,6 +1384,16 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { ...@@ -1381,6 +1384,16 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
AccessMode::kLoad); AccessMode::kLoad);
} }
Reduction JSNativeContextSpecialization::ReduceJSGetIterator(Node* node) {
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
DCHECK_EQ(IrOpcode::kJSGetIterator, node->opcode());
PropertyAccess const& p = PropertyAccessOf(node->op());
NameRef name(broker(), factory()->iterator_symbol());
return ReducePropertyAccess(node, nullptr, name, jsgraph()->Dead(),
FeedbackSource(p.feedback()), AccessMode::kLoad);
}
Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) { Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining); DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
DCHECK_EQ(IrOpcode::kJSStoreNamed, node->opcode()); DCHECK_EQ(IrOpcode::kJSStoreNamed, node->opcode());
...@@ -1756,7 +1769,8 @@ Reduction JSNativeContextSpecialization::ReducePropertyAccess( ...@@ -1756,7 +1769,8 @@ Reduction JSNativeContextSpecialization::ReducePropertyAccess(
node->opcode() == IrOpcode::kJSHasProperty || node->opcode() == IrOpcode::kJSHasProperty ||
node->opcode() == IrOpcode::kJSLoadNamed || node->opcode() == IrOpcode::kJSLoadNamed ||
node->opcode() == IrOpcode::kJSStoreNamed || node->opcode() == IrOpcode::kJSStoreNamed ||
node->opcode() == IrOpcode::kJSStoreNamedOwn); node->opcode() == IrOpcode::kJSStoreNamedOwn ||
node->opcode() == IrOpcode::kJSGetIterator);
Node* receiver = NodeProperties::GetValueInput(node, 0); Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
......
...@@ -84,6 +84,7 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final ...@@ -84,6 +84,7 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final
Reduction ReduceJSLoadGlobal(Node* node); Reduction ReduceJSLoadGlobal(Node* node);
Reduction ReduceJSStoreGlobal(Node* node); Reduction ReduceJSStoreGlobal(Node* node);
Reduction ReduceJSLoadNamed(Node* node); Reduction ReduceJSLoadNamed(Node* node);
Reduction ReduceJSGetIterator(Node* node);
Reduction ReduceJSStoreNamed(Node* node); Reduction ReduceJSStoreNamed(Node* node);
Reduction ReduceJSHasProperty(Node* node); Reduction ReduceJSHasProperty(Node* node);
Reduction ReduceJSLoadProperty(Node* node); Reduction ReduceJSLoadProperty(Node* node);
......
...@@ -283,7 +283,8 @@ bool operator!=(PropertyAccess const& lhs, PropertyAccess const& rhs) { ...@@ -283,7 +283,8 @@ bool operator!=(PropertyAccess const& lhs, PropertyAccess const& rhs) {
PropertyAccess const& PropertyAccessOf(const Operator* op) { PropertyAccess const& PropertyAccessOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kJSHasProperty || DCHECK(op->opcode() == IrOpcode::kJSHasProperty ||
op->opcode() == IrOpcode::kJSLoadProperty || op->opcode() == IrOpcode::kJSLoadProperty ||
op->opcode() == IrOpcode::kJSStoreProperty); op->opcode() == IrOpcode::kJSStoreProperty ||
op->opcode() == IrOpcode::kJSGetIterator);
return OpParameter<PropertyAccess>(op); return OpParameter<PropertyAccess>(op);
} }
...@@ -953,6 +954,15 @@ const Operator* JSOperatorBuilder::LoadProperty( ...@@ -953,6 +954,15 @@ const Operator* JSOperatorBuilder::LoadProperty(
access); // parameter access); // parameter
} }
const Operator* JSOperatorBuilder::GetIterator(VectorSlotPair const& feedback) {
PropertyAccess access(LanguageMode::kSloppy, feedback);
return new (zone()) Operator1<PropertyAccess>( // --
IrOpcode::kJSGetIterator, Operator::kNoProperties, // opcode
"JSGetIterator", // name
1, 1, 1, 1, 1, 2, // counts
access); // parameter
}
const Operator* JSOperatorBuilder::HasProperty(VectorSlotPair const& feedback) { const Operator* JSOperatorBuilder::HasProperty(VectorSlotPair const& feedback) {
PropertyAccess access(LanguageMode::kSloppy, feedback); PropertyAccess access(LanguageMode::kSloppy, feedback);
return new (zone()) Operator1<PropertyAccess>( // -- return new (zone()) Operator1<PropertyAccess>( // --
......
...@@ -854,6 +854,8 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final ...@@ -854,6 +854,8 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* ParseInt(); const Operator* ParseInt();
const Operator* RegExpTest(); const Operator* RegExpTest();
const Operator* GetIterator(VectorSlotPair const& feedback);
private: private:
Zone* zone() const { return zone_; } Zone* zone() const { return zone_; }
......
...@@ -203,6 +203,7 @@ ...@@ -203,6 +203,7 @@
V(JSForInEnumerate) \ V(JSForInEnumerate) \
V(JSForInNext) \ V(JSForInNext) \
V(JSForInPrepare) \ V(JSForInPrepare) \
V(JSGetIterator) \
V(JSLoadMessage) \ V(JSLoadMessage) \
V(JSStoreMessage) \ V(JSStoreMessage) \
V(JSLoadModule) \ V(JSLoadModule) \
......
...@@ -54,6 +54,7 @@ bool OperatorProperties::NeedsExactContext(const Operator* op) { ...@@ -54,6 +54,7 @@ bool OperatorProperties::NeedsExactContext(const Operator* op) {
case IrOpcode::kJSStackCheck: case IrOpcode::kJSStackCheck:
case IrOpcode::kJSStoreGlobal: case IrOpcode::kJSStoreGlobal:
case IrOpcode::kJSStoreMessage: case IrOpcode::kJSStoreMessage:
case IrOpcode::kJSGetIterator:
return false; return false;
case IrOpcode::kJSCallRuntime: case IrOpcode::kJSCallRuntime:
...@@ -237,6 +238,9 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) { ...@@ -237,6 +238,9 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) {
case IrOpcode::kJSPerformPromiseThen: case IrOpcode::kJSPerformPromiseThen:
case IrOpcode::kJSObjectIsArray: case IrOpcode::kJSObjectIsArray:
case IrOpcode::kJSRegExpTest: case IrOpcode::kJSRegExpTest:
// Iterator protocol operations
case IrOpcode::kJSGetIterator:
return true; return true;
default: default:
......
...@@ -166,6 +166,7 @@ namespace compiler { ...@@ -166,6 +166,7 @@ namespace compiler {
V(CreateEvalContext) \ V(CreateEvalContext) \
V(CreateFunctionContext) \ V(CreateFunctionContext) \
V(CreateWithContext) \ V(CreateWithContext) \
V(GetIterator) \
V(GetSuperConstructor) \ V(GetSuperConstructor) \
V(GetTemplateObject) \ V(GetTemplateObject) \
V(InvokeIntrinsic) \ V(InvokeIntrinsic) \
...@@ -991,6 +992,16 @@ void SerializerForBackgroundCompilation::TraverseBytecode() { ...@@ -991,6 +992,16 @@ void SerializerForBackgroundCompilation::TraverseBytecode() {
} }
} }
void SerializerForBackgroundCompilation::VisitGetIterator(
BytecodeArrayIterator* iterator) {
AccessMode mode = AccessMode::kLoad;
Hints const& receiver =
environment()->register_hints(iterator->GetRegisterOperand(0));
Handle<Name> name = broker()->isolate()->factory()->iterator_symbol();
FeedbackSlot slot = iterator->GetSlotOperand(1);
ProcessNamedPropertyAccess(receiver, NameRef(broker(), name), slot, mode);
}
void SerializerForBackgroundCompilation::VisitGetSuperConstructor( void SerializerForBackgroundCompilation::VisitGetSuperConstructor(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
interpreter::Register dst = iterator->GetRegisterOperand(0); interpreter::Register dst = iterator->GetRegisterOperand(0);
......
...@@ -2361,6 +2361,8 @@ Type Typer::Visitor::TypeConstant(Handle<Object> value) { ...@@ -2361,6 +2361,8 @@ Type Typer::Visitor::TypeConstant(Handle<Object> value) {
return Type::NewConstant(typer_->broker(), value, zone()); return Type::NewConstant(typer_->broker(), value, zone());
} }
Type Typer::Visitor::TypeJSGetIterator(Node* node) { return Type::Any(); }
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -765,6 +765,11 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) { ...@@ -765,6 +765,11 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckNotTyped(node); CheckNotTyped(node);
CHECK(StoreNamedOwnParametersOf(node->op()).feedback().IsValid()); CHECK(StoreNamedOwnParametersOf(node->op()).feedback().IsValid());
break; break;
case IrOpcode::kJSGetIterator:
// Type can be anything
CheckValueInputIs(node, 0, Type::Any());
CheckTypeIs(node, Type::Any());
break;
case IrOpcode::kJSStoreDataPropertyInLiteral: case IrOpcode::kJSStoreDataPropertyInLiteral:
case IrOpcode::kJSStoreInArrayLiteral: case IrOpcode::kJSStoreInArrayLiteral:
// Type is empty. // Type is empty.
......
...@@ -383,6 +383,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) { ...@@ -383,6 +383,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) {
case Bytecode::kLdaKeyedProperty: case Bytecode::kLdaKeyedProperty:
case Bytecode::kLdaGlobalInsideTypeof: case Bytecode::kLdaGlobalInsideTypeof:
case Bytecode::kLdaLookupSlotInsideTypeof: case Bytecode::kLdaLookupSlotInsideTypeof:
case Bytecode::kGetIterator:
// Arithmetics. // Arithmetics.
case Bytecode::kAdd: case Bytecode::kAdd:
case Bytecode::kAddSmi: case Bytecode::kAddSmi:
......
...@@ -810,10 +810,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty( ...@@ -810,10 +810,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
return *this; return *this;
} }
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadIteratorProperty( BytecodeArrayBuilder& BytecodeArrayBuilder::GetIterator(Register object,
Register object, int feedback_slot) { int feedback_slot) {
size_t name_index = IteratorSymbolConstantPoolEntry(); OutputGetIterator(object, feedback_slot);
OutputLdaNamedProperty(object, name_index, feedback_slot);
return *this; return *this;
} }
......
...@@ -127,9 +127,10 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final { ...@@ -127,9 +127,10 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
// Keyed load property. The key should be in the accumulator. // Keyed load property. The key should be in the accumulator.
BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot); BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot);
// Named load property of the @@iterator symbol. // Named load property of the @@iterator symbol.
BytecodeArrayBuilder& LoadIteratorProperty(Register object, BytecodeArrayBuilder& GetIterator(Register object, int feedback_slot);
int feedback_slot);
// Named load property of the @@asyncIterator symbol. // Named load property of the @@asyncIterator symbol.
BytecodeArrayBuilder& LoadAsyncIteratorProperty(Register object, BytecodeArrayBuilder& LoadAsyncIteratorProperty(Register object,
int feedback_slot); int feedback_slot);
......
...@@ -5266,8 +5266,7 @@ void BytecodeGenerator::BuildGetIterator(IteratorType hint) { ...@@ -5266,8 +5266,7 @@ void BytecodeGenerator::BuildGetIterator(IteratorType hint) {
// If method is undefined, // If method is undefined,
// Let syncMethod be GetMethod(obj, @@iterator) // Let syncMethod be GetMethod(obj, @@iterator)
builder() builder()
->LoadIteratorProperty(obj, ->GetIterator(obj, feedback_index(feedback_spec()->AddLoadICSlot()))
feedback_index(feedback_spec()->AddLoadICSlot()))
.StoreAccumulatorInRegister(method); .StoreAccumulatorInRegister(method);
// Let syncIterator be Call(syncMethod, obj) // Let syncIterator be Call(syncMethod, obj)
...@@ -5285,8 +5284,7 @@ void BytecodeGenerator::BuildGetIterator(IteratorType hint) { ...@@ -5285,8 +5284,7 @@ void BytecodeGenerator::BuildGetIterator(IteratorType hint) {
// Let method be GetMethod(obj, @@iterator). // Let method be GetMethod(obj, @@iterator).
builder() builder()
->StoreAccumulatorInRegister(obj) ->StoreAccumulatorInRegister(obj)
.LoadIteratorProperty(obj, .GetIterator(obj, feedback_index(feedback_spec()->AddLoadICSlot()))
feedback_index(feedback_spec()->AddLoadICSlot()))
.StoreAccumulatorInRegister(method); .StoreAccumulatorInRegister(method);
// Let iterator be Call(method, obj). // Let iterator be Call(method, obj).
......
...@@ -355,6 +355,9 @@ namespace interpreter { ...@@ -355,6 +355,9 @@ namespace interpreter {
V(ResumeGenerator, AccumulatorUse::kWrite, OperandType::kReg, \ V(ResumeGenerator, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kRegOutList, OperandType::kRegCount) \ OperandType::kRegOutList, OperandType::kRegCount) \
\ \
/* Iterator protocol operations */ \
V(GetIterator, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kIdx) \
\
/* Debugger */ \ /* Debugger */ \
V(Debugger, AccumulatorUse::kNone) \ V(Debugger, AccumulatorUse::kNone) \
\ \
......
...@@ -3172,6 +3172,25 @@ IGNITION_HANDLER(ForInStep, InterpreterAssembler) { ...@@ -3172,6 +3172,25 @@ IGNITION_HANDLER(ForInStep, InterpreterAssembler) {
Dispatch(); Dispatch();
} }
// GetIterator <object>
//
// Retrieves the object[Symbol.iterator] method and stores the result
// in the accumulator
// TODO(swapnilgaikwad): Extend the functionality of the bytecode to call
// iterator method for an object
IGNITION_HANDLER(GetIterator, InterpreterAssembler) {
Node* receiver = LoadRegisterAtOperandIndex(0);
Node* context = GetContext();
Node* feedback_vector = LoadFeedbackVector();
Node* feedback_slot = BytecodeOperandIdx(1);
Node* smi_slot = SmiTag(feedback_slot);
Node* result = CallBuiltin(Builtins::kGetIteratorWithFeedback, context,
receiver, smi_slot, feedback_vector);
SetAccumulator(result);
Dispatch();
}
// Wide // Wide
// //
// Prefix bytecode indicating next bytecode has wide (16-bit) operands. // Prefix bytecode indicating next bytecode has wide (16-bit) operands.
......
...@@ -143,7 +143,7 @@ snippet: " ...@@ -143,7 +143,7 @@ snippet: "
" "
frame size: 8 frame size: 8
parameter count: 1 parameter count: 1
bytecode array length: 84 bytecode array length: 83
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
...@@ -152,22 +152,22 @@ bytecodes: [ ...@@ -152,22 +152,22 @@ bytecodes: [
B(Star), R(2), B(Star), R(2),
B(LdaConstant), U8(2), B(LdaConstant), U8(2),
/* 67 S> */ B(Star), R(1), /* 67 S> */ B(Star), R(1),
B(LdaNamedProperty), R(0), U8(3), U8(2), B(GetIterator), R(0), U8(2),
B(Star), R(6), B(Star), R(6),
B(CallProperty0), R(6), R(0), U8(4), B(CallProperty0), R(6), R(0), U8(4),
B(Mov), R(0), R(5), B(Mov), R(0), R(5),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(4), B(Star), R(4),
B(LdaNamedProperty), R(4), U8(4), U8(6), B(LdaNamedProperty), R(4), U8(3), U8(6),
B(Star), R(3), B(Star), R(3),
B(CallProperty0), R(3), R(4), U8(15), B(CallProperty0), R(3), R(4), U8(15),
B(Star), R(7), B(Star), R(7),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1),
B(LdaNamedProperty), R(7), U8(5), U8(17), B(LdaNamedProperty), R(7), U8(4), U8(17),
B(JumpIfToBooleanTrue), U8(19), B(JumpIfToBooleanTrue), U8(19),
B(LdaNamedProperty), R(7), U8(6), U8(8), B(LdaNamedProperty), R(7), U8(5), U8(8),
B(StaInArrayLiteral), R(2), R(1), U8(13), B(StaInArrayLiteral), R(2), R(1), U8(13),
B(Ldar), R(1), B(Ldar), R(1),
B(Inc), U8(12), B(Inc), U8(12),
...@@ -180,7 +180,6 @@ constant pool: [ ...@@ -180,7 +180,6 @@ constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
Smi [1], Smi [1],
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
......
...@@ -214,7 +214,7 @@ snippet: " ...@@ -214,7 +214,7 @@ snippet: "
" "
frame size: 21 frame size: 21
parameter count: 1 parameter count: 1
bytecode array length: 370 bytecode array length: 369
bytecodes: [ bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4), B(Mov), R(closure), R(4),
...@@ -235,16 +235,16 @@ bytecodes: [ ...@@ -235,16 +235,16 @@ bytecodes: [
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
B(Star), R(4), B(Star), R(4),
B(Mov), R(8), R(5), B(Mov), R(8), R(5),
B(JumpConstant), U8(16), B(JumpConstant), U8(15),
/* 36 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37), /* 36 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37),
B(Star), R(10), B(Star), R(10),
B(LdaNamedProperty), R(10), U8(5), U8(1), B(GetIterator), R(10), U8(1),
B(Star), R(11), B(Star), R(11),
B(CallProperty0), R(11), R(10), U8(3), B(CallProperty0), R(11), R(10), U8(3),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(9), B(Star), R(9),
B(LdaNamedProperty), R(9), U8(6), U8(5), B(LdaNamedProperty), R(9), U8(5), U8(5),
B(Star), R(8), B(Star), R(8),
B(LdaFalse), B(LdaFalse),
B(Star), R(12), B(Star), R(12),
...@@ -255,9 +255,9 @@ bytecodes: [ ...@@ -255,9 +255,9 @@ bytecodes: [
B(Star), R(16), B(Star), R(16),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(16), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(16), U8(1),
B(LdaNamedProperty), R(16), U8(7), U8(9), B(LdaNamedProperty), R(16), U8(6), U8(9),
B(JumpIfToBooleanTrue), U8(67), B(JumpIfToBooleanTrue), U8(67),
B(LdaNamedProperty), R(16), U8(8), U8(11), B(LdaNamedProperty), R(16), U8(7), U8(11),
B(Star), R(16), B(Star), R(16),
B(LdaFalse), B(LdaFalse),
B(Star), R(12), B(Star), R(12),
...@@ -273,7 +273,7 @@ bytecodes: [ ...@@ -273,7 +273,7 @@ bytecodes: [
B(ResumeGenerator), R(0), R(0), U8(17), B(ResumeGenerator), R(0), R(0), U8(17),
B(Star), R(17), B(Star), R(17),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
B(Ldar), R(17), B(Ldar), R(17),
/* 42 E> */ B(Throw), /* 42 E> */ B(Throw),
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
...@@ -294,7 +294,7 @@ bytecodes: [ ...@@ -294,7 +294,7 @@ bytecodes: [
B(Star), R(15), B(Star), R(15),
B(Ldar), R(12), B(Ldar), R(12),
B(JumpIfToBooleanTrue), U8(58), B(JumpIfToBooleanTrue), U8(58),
B(LdaNamedProperty), R(9), U8(11), U8(13), B(LdaNamedProperty), R(9), U8(10), U8(13),
B(Star), R(17), B(Star), R(17),
B(JumpIfUndefinedOrNull), U8(50), B(JumpIfUndefinedOrNull), U8(50),
B(Mov), R(context), R(18), B(Mov), R(context), R(18),
...@@ -302,7 +302,7 @@ bytecodes: [ ...@@ -302,7 +302,7 @@ bytecodes: [
B(JumpIfTrue), U8(18), B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(159), B(Wide), B(LdaSmi), I16(159),
B(Star), R(19), B(Star), R(19),
B(LdaConstant), U8(12), B(LdaConstant), U8(11),
B(Star), R(20), B(Star), R(20),
B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2),
B(Throw), B(Throw),
...@@ -320,7 +320,7 @@ bytecodes: [ ...@@ -320,7 +320,7 @@ bytecodes: [
B(Ldar), R(15), B(Ldar), R(15),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(13), B(Ldar), R(13),
B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
B(Jump), U8(14), B(Jump), U8(14),
B(Ldar), R(14), B(Ldar), R(14),
B(ReThrow), B(ReThrow),
...@@ -330,7 +330,7 @@ bytecodes: [ ...@@ -330,7 +330,7 @@ bytecodes: [
B(Jump), U8(51), B(Jump), U8(51),
B(Jump), U8(36), B(Jump), U8(36),
B(Star), R(8), B(Star), R(8),
B(CreateCatchContext), R(8), U8(15), B(CreateCatchContext), R(8), U8(14),
B(Star), R(7), B(Star), R(7),
B(LdaTheHole), B(LdaTheHole),
B(SetPendingMessage), B(SetPendingMessage),
...@@ -359,7 +359,7 @@ bytecodes: [ ...@@ -359,7 +359,7 @@ bytecodes: [
B(Ldar), R(6), B(Ldar), R(6),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(4), B(Ldar), R(4),
B(SwitchOnSmiNoFeedback), U8(17), U8(3), I8(0), B(SwitchOnSmiNoFeedback), U8(16), U8(3), I8(0),
B(Jump), U8(22), B(Jump), U8(22),
B(Ldar), R(5), B(Ldar), R(5),
B(ReThrow), B(ReThrow),
...@@ -376,11 +376,10 @@ bytecodes: [ ...@@ -376,11 +376,10 @@ bytecodes: [
] ]
constant pool: [ constant pool: [
Smi [30], Smi [30],
Smi [149], Smi [148],
Smi [16], Smi [16],
Smi [7], Smi [7],
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
...@@ -391,16 +390,16 @@ constant pool: [ ...@@ -391,16 +390,16 @@ constant pool: [
Smi [6], Smi [6],
Smi [9], Smi [9],
SCOPE_INFO_TYPE, SCOPE_INFO_TYPE,
Smi [275], Smi [274],
Smi [6], Smi [6],
Smi [9], Smi [9],
Smi [23], Smi [23],
] ]
handlers: [ handlers: [
[20, 316, 324], [20, 315, 323],
[23, 280, 282], [23, 279, 281],
[93, 180, 188], [92, 179, 187],
[212, 245, 247], [211, 244, 246],
] ]
--- ---
...@@ -411,7 +410,7 @@ snippet: " ...@@ -411,7 +410,7 @@ snippet: "
" "
frame size: 19 frame size: 19
parameter count: 1 parameter count: 1
bytecode array length: 467 bytecode array length: 466
bytecodes: [ bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(5), B(SwitchOnGeneratorState), R(0), U8(0), U8(5),
B(Mov), R(closure), R(1), B(Mov), R(closure), R(1),
...@@ -432,7 +431,7 @@ bytecodes: [ ...@@ -432,7 +431,7 @@ bytecodes: [
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
B(Star), R(1), B(Star), R(1),
B(Mov), R(5), R(2), B(Mov), R(5), R(2),
B(JumpConstant), U8(18), B(JumpConstant), U8(17),
/* 49 S> */ B(LdaGlobal), U8(7), U8(0), /* 49 S> */ B(LdaGlobal), U8(7), U8(0),
B(Star), R(9), B(Star), R(9),
/* 56 E> */ B(CallUndefinedReceiver0), R(9), U8(2), /* 56 E> */ B(CallUndefinedReceiver0), R(9), U8(2),
...@@ -441,25 +440,25 @@ bytecodes: [ ...@@ -441,25 +440,25 @@ bytecodes: [
B(JumpIfUndefinedOrNull), U8(15), B(JumpIfUndefinedOrNull), U8(15),
B(Star), R(11), B(Star), R(11),
B(CallProperty0), R(11), R(10), U8(6), B(CallProperty0), R(11), R(10), U8(6),
B(JumpIfJSReceiver), U8(23), B(JumpIfJSReceiver), U8(22),
B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0),
B(LdaNamedProperty), R(10), U8(9), U8(8), B(GetIterator), R(10), U8(8),
B(Star), R(11), B(Star), R(11),
B(CallProperty0), R(11), R(10), U8(10), B(CallProperty0), R(11), R(10), U8(10),
B(Star), R(11), B(Star), R(11),
B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(11), U8(1), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(11), U8(1),
B(Star), R(7), B(Star), R(7),
B(LdaNamedProperty), R(7), U8(10), U8(12), B(LdaNamedProperty), R(7), U8(9), U8(12),
B(Star), R(9), B(Star), R(9),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(8), B(Star), R(8),
B(LdaZero), B(LdaZero),
B(Star), R(6), B(Star), R(6),
B(Ldar), R(6), B(Ldar), R(6),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(1), B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(1),
B(CallProperty1), R(9), R(7), R(8), U8(14), B(CallProperty1), R(9), R(7), R(8), U8(14),
B(Jump), U8(140), B(Jump), U8(140),
B(LdaNamedProperty), R(7), U8(13), U8(16), B(LdaNamedProperty), R(7), U8(12), U8(16),
B(JumpIfUndefinedOrNull), U8(11), B(JumpIfUndefinedOrNull), U8(11),
B(Star), R(12), B(Star), R(12),
B(CallProperty1), R(12), R(7), R(8), U8(18), B(CallProperty1), R(12), R(7), R(8), U8(18),
...@@ -481,12 +480,12 @@ bytecodes: [ ...@@ -481,12 +480,12 @@ bytecodes: [
B(Star), R(1), B(Star), R(1),
B(Mov), R(12), R(2), B(Mov), R(12), R(2),
B(Jump), U8(241), B(Jump), U8(241),
B(LdaNamedProperty), R(7), U8(14), U8(20), B(LdaNamedProperty), R(7), U8(13), U8(20),
B(JumpIfUndefinedOrNull), U8(11), B(JumpIfUndefinedOrNull), U8(11),
B(Star), R(14), B(Star), R(14),
B(CallProperty1), R(14), R(7), R(8), U8(22), B(CallProperty1), R(14), R(7), R(8), U8(22),
B(Jump), U8(66), B(Jump), U8(66),
B(LdaNamedProperty), R(7), U8(13), U8(24), B(LdaNamedProperty), R(7), U8(12), U8(24),
B(JumpIfUndefinedOrNull), U8(55), B(JumpIfUndefinedOrNull), U8(55),
B(Star), R(14), B(Star), R(14),
B(CallProperty0), R(14), R(7), U8(26), B(CallProperty0), R(14), R(7), U8(26),
...@@ -526,9 +525,9 @@ bytecodes: [ ...@@ -526,9 +525,9 @@ bytecodes: [
B(Mov), R(14), R(5), B(Mov), R(14), R(5),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1),
B(LdaNamedProperty), R(5), U8(15), U8(28), B(LdaNamedProperty), R(5), U8(14), U8(28),
B(JumpIfToBooleanTrue), U8(38), B(JumpIfToBooleanTrue), U8(38),
B(LdaNamedProperty), R(5), U8(16), U8(30), B(LdaNamedProperty), R(5), U8(15), U8(30),
B(Star), R(17), B(Star), R(17),
B(LdaFalse), B(LdaFalse),
B(Star), R(18), B(Star), R(18),
...@@ -540,7 +539,7 @@ bytecodes: [ ...@@ -540,7 +539,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(6), B(Star), R(6),
B(JumpLoop), U8(236), I8(0), B(JumpLoop), U8(236), I8(0),
B(LdaNamedProperty), R(5), U8(16), U8(32), B(LdaNamedProperty), R(5), U8(15), U8(32),
B(Star), R(7), B(Star), R(7),
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
B(TestReferenceEqual), R(6), B(TestReferenceEqual), R(6),
...@@ -552,7 +551,7 @@ bytecodes: [ ...@@ -552,7 +551,7 @@ bytecodes: [
B(Ldar), R(7), B(Ldar), R(7),
B(Jump), U8(36), B(Jump), U8(36),
B(Star), R(5), B(Star), R(5),
B(CreateCatchContext), R(5), U8(17), B(CreateCatchContext), R(5), U8(16),
B(Star), R(4), B(Star), R(4),
B(LdaTheHole), B(LdaTheHole),
B(SetPendingMessage), B(SetPendingMessage),
...@@ -581,7 +580,7 @@ bytecodes: [ ...@@ -581,7 +580,7 @@ bytecodes: [
B(Ldar), R(3), B(Ldar), R(3),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(1), B(Ldar), R(1),
B(SwitchOnSmiNoFeedback), U8(19), U8(3), I8(0), B(SwitchOnSmiNoFeedback), U8(18), U8(3), I8(0),
B(Jump), U8(22), B(Jump), U8(22),
B(Ldar), R(2), B(Ldar), R(2),
B(ReThrow), B(ReThrow),
...@@ -598,15 +597,14 @@ bytecodes: [ ...@@ -598,15 +597,14 @@ bytecodes: [
] ]
constant pool: [ constant pool: [
Smi [30], Smi [30],
Smi [158], Smi [157],
Smi [230], Smi [229],
Smi [280], Smi [279],
Smi [339], Smi [338],
Smi [16], Smi [16],
Smi [7], Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
SYMBOL_TYPE, SYMBOL_TYPE,
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
Smi [11], Smi [11],
Smi [70], Smi [70],
...@@ -615,13 +613,13 @@ constant pool: [ ...@@ -615,13 +613,13 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
SCOPE_INFO_TYPE, SCOPE_INFO_TYPE,
Smi [372], Smi [371],
Smi [6], Smi [6],
Smi [9], Smi [9],
Smi [23], Smi [23],
] ]
handlers: [ handlers: [
[20, 413, 421], [20, 412, 420],
[23, 375, 379], [23, 374, 378],
] ]
...@@ -67,7 +67,7 @@ snippet: " ...@@ -67,7 +67,7 @@ snippet: "
" "
frame size: 10 frame size: 10
parameter count: 1 parameter count: 1
bytecode array length: 107 bytecode array length: 106
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaGlobal), U8(0), U8(0), /* 34 S> */ B(LdaGlobal), U8(0), U8(0),
...@@ -80,22 +80,22 @@ bytecodes: [ ...@@ -80,22 +80,22 @@ bytecodes: [
B(Star), R(3), B(Star), R(3),
/* 49 S> */ B(CreateArrayLiteral), U8(4), U8(5), U8(37), /* 49 S> */ B(CreateArrayLiteral), U8(4), U8(5), U8(37),
B(Star), R(7), B(Star), R(7),
B(LdaNamedProperty), R(7), U8(5), U8(6), B(GetIterator), R(7), U8(6),
B(Star), R(8), B(Star), R(8),
B(CallProperty0), R(8), R(7), U8(8), B(CallProperty0), R(8), R(7), U8(8),
B(Mov), R(0), R(2), B(Mov), R(0), R(2),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(6), B(Star), R(6),
B(LdaNamedProperty), R(6), U8(6), U8(10), B(LdaNamedProperty), R(6), U8(5), U8(10),
B(Star), R(5), B(Star), R(5),
B(CallProperty0), R(5), R(6), U8(19), B(CallProperty0), R(5), R(6), U8(19),
B(Star), R(9), B(Star), R(9),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1),
B(LdaNamedProperty), R(9), U8(7), U8(21), B(LdaNamedProperty), R(9), U8(6), U8(21),
B(JumpIfToBooleanTrue), U8(19), B(JumpIfToBooleanTrue), U8(19),
B(LdaNamedProperty), R(9), U8(8), U8(12), B(LdaNamedProperty), R(9), U8(7), U8(12),
B(StaInArrayLiteral), R(4), R(3), U8(17), B(StaInArrayLiteral), R(4), R(3), U8(17),
B(Ldar), R(3), B(Ldar), R(3),
B(Inc), U8(16), B(Inc), U8(16),
...@@ -114,7 +114,6 @@ constant pool: [ ...@@ -114,7 +114,6 @@ constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
Smi [1], Smi [1],
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
......
...@@ -100,7 +100,7 @@ snippet: " ...@@ -100,7 +100,7 @@ snippet: "
" "
frame size: 17 frame size: 17
parameter count: 1 parameter count: 1
bytecode array length: 259 bytecode array length: 258
bytecodes: [ bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4), B(Mov), R(closure), R(4),
...@@ -119,13 +119,13 @@ bytecodes: [ ...@@ -119,13 +119,13 @@ bytecodes: [
/* 44 S> */ B(Return), /* 44 S> */ B(Return),
/* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37), /* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37),
B(Star), R(6), B(Star), R(6),
B(LdaNamedProperty), R(6), U8(5), U8(1), B(GetIterator), R(6), U8(1),
B(Star), R(7), B(Star), R(7),
B(CallProperty0), R(7), R(6), U8(3), B(CallProperty0), R(7), R(6), U8(3),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(5), B(Star), R(5),
B(LdaNamedProperty), R(5), U8(6), U8(5), B(LdaNamedProperty), R(5), U8(5), U8(5),
B(Star), R(4), B(Star), R(4),
B(LdaFalse), B(LdaFalse),
B(Star), R(8), B(Star), R(8),
...@@ -136,9 +136,9 @@ bytecodes: [ ...@@ -136,9 +136,9 @@ bytecodes: [
B(Star), R(12), B(Star), R(12),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(7), U8(9), B(LdaNamedProperty), R(12), U8(6), U8(9),
B(JumpIfToBooleanTrue), U8(64), B(JumpIfToBooleanTrue), U8(64),
B(LdaNamedProperty), R(12), U8(8), U8(11), B(LdaNamedProperty), R(12), U8(7), U8(11),
B(Star), R(12), B(Star), R(12),
B(LdaFalse), B(LdaFalse),
B(Star), R(8), B(Star), R(8),
...@@ -153,7 +153,7 @@ bytecodes: [ ...@@ -153,7 +153,7 @@ bytecodes: [
B(ResumeGenerator), R(0), R(0), U8(13), B(ResumeGenerator), R(0), R(0), U8(13),
B(Star), R(13), B(Star), R(13),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
B(Ldar), R(13), B(Ldar), R(13),
/* 36 E> */ B(Throw), /* 36 E> */ B(Throw),
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
...@@ -174,7 +174,7 @@ bytecodes: [ ...@@ -174,7 +174,7 @@ bytecodes: [
B(Star), R(11), B(Star), R(11),
B(Ldar), R(8), B(Ldar), R(8),
B(JumpIfToBooleanTrue), U8(58), B(JumpIfToBooleanTrue), U8(58),
B(LdaNamedProperty), R(5), U8(11), U8(13), B(LdaNamedProperty), R(5), U8(10), U8(13),
B(Star), R(13), B(Star), R(13),
B(JumpIfUndefinedOrNull), U8(50), B(JumpIfUndefinedOrNull), U8(50),
B(Mov), R(context), R(14), B(Mov), R(context), R(14),
...@@ -182,7 +182,7 @@ bytecodes: [ ...@@ -182,7 +182,7 @@ bytecodes: [
B(JumpIfTrue), U8(18), B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(159), B(Wide), B(LdaSmi), I16(159),
B(Star), R(15), B(Star), R(15),
B(LdaConstant), U8(12), B(LdaConstant), U8(11),
B(Star), R(16), B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2), B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw), B(Throw),
...@@ -200,7 +200,7 @@ bytecodes: [ ...@@ -200,7 +200,7 @@ bytecodes: [
B(Ldar), R(11), B(Ldar), R(11),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(9), B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
B(Jump), U8(8), B(Jump), U8(8),
B(Ldar), R(10), B(Ldar), R(10),
B(ReThrow), B(ReThrow),
...@@ -211,11 +211,10 @@ bytecodes: [ ...@@ -211,11 +211,10 @@ bytecodes: [
] ]
constant pool: [ constant pool: [
Smi [22], Smi [22],
Smi [132], Smi [131],
Smi [10], Smi [10],
Smi [7], Smi [7],
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
...@@ -227,8 +226,8 @@ constant pool: [ ...@@ -227,8 +226,8 @@ constant pool: [
Smi [9], Smi [9],
] ]
handlers: [ handlers: [
[79, 163, 171], [78, 162, 170],
[195, 228, 230], [194, 227, 229],
] ]
--- ---
...@@ -239,7 +238,7 @@ snippet: " ...@@ -239,7 +238,7 @@ snippet: "
" "
frame size: 9 frame size: 9
parameter count: 1 parameter count: 1
bytecode array length: 211 bytecode array length: 210
bytecodes: [ bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(1), B(Mov), R(closure), R(1),
...@@ -260,35 +259,35 @@ bytecodes: [ ...@@ -260,35 +259,35 @@ bytecodes: [
B(Star), R(5), B(Star), R(5),
/* 50 E> */ B(CallUndefinedReceiver0), R(5), U8(2), /* 50 E> */ B(CallUndefinedReceiver0), R(5), U8(2),
B(Star), R(6), B(Star), R(6),
B(LdaNamedProperty), R(6), U8(5), U8(4), B(GetIterator), R(6), U8(4),
B(Star), R(7), B(Star), R(7),
B(CallProperty0), R(7), R(6), U8(6), B(CallProperty0), R(7), R(6), U8(6),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(3), B(Star), R(3),
B(LdaNamedProperty), R(3), U8(6), U8(8), B(LdaNamedProperty), R(3), U8(5), U8(8),
B(Star), R(5), B(Star), R(5),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(4), B(Star), R(4),
B(LdaZero), B(LdaZero),
B(Star), R(2), B(Star), R(2),
B(Ldar), R(2), B(Ldar), R(2),
B(SwitchOnSmiNoFeedback), U8(7), U8(2), I8(1), B(SwitchOnSmiNoFeedback), U8(6), U8(2), I8(1),
B(CallProperty1), R(5), R(3), R(4), U8(10), B(CallProperty1), R(5), R(3), R(4), U8(10),
B(Jump), U8(63), B(Jump), U8(63),
B(LdaNamedProperty), R(3), U8(9), U8(12), B(LdaNamedProperty), R(3), U8(8), U8(12),
B(JumpIfUndefinedOrNull), U8(11), B(JumpIfUndefinedOrNull), U8(11),
B(Star), R(8), B(Star), R(8),
B(CallProperty1), R(8), R(3), R(4), U8(14), B(CallProperty1), R(8), R(3), R(4), U8(14),
B(Jump), U8(48), B(Jump), U8(48),
B(Ldar), R(4), B(Ldar), R(4),
/* 54 S> */ B(Return), /* 54 S> */ B(Return),
B(LdaNamedProperty), R(3), U8(10), U8(16), B(LdaNamedProperty), R(3), U8(9), U8(16),
B(JumpIfUndefinedOrNull), U8(11), B(JumpIfUndefinedOrNull), U8(11),
B(Star), R(8), B(Star), R(8),
B(CallProperty1), R(8), R(3), R(4), U8(18), B(CallProperty1), R(8), R(3), R(4), U8(18),
B(Jump), U8(30), B(Jump), U8(30),
B(LdaNamedProperty), R(3), U8(9), U8(20), B(LdaNamedProperty), R(3), U8(8), U8(20),
B(JumpIfUndefinedOrNull), U8(19), B(JumpIfUndefinedOrNull), U8(19),
B(Star), R(8), B(Star), R(8),
B(CallProperty0), R(8), R(3), U8(22), B(CallProperty0), R(8), R(3), U8(22),
...@@ -300,7 +299,7 @@ bytecodes: [ ...@@ -300,7 +299,7 @@ bytecodes: [
B(Star), R(1), B(Star), R(1),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1),
B(LdaNamedProperty), R(1), U8(11), U8(24), B(LdaNamedProperty), R(1), U8(10), U8(24),
B(JumpIfToBooleanTrue), U8(24), B(JumpIfToBooleanTrue), U8(24),
B(Ldar), R(1), B(Ldar), R(1),
/* 43 E> */ B(SuspendGenerator), R(0), R(0), U8(8), U8(1), /* 43 E> */ B(SuspendGenerator), R(0), R(0), U8(8), U8(1),
...@@ -309,7 +308,7 @@ bytecodes: [ ...@@ -309,7 +308,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(2), B(Star), R(2),
B(JumpLoop), U8(108), I8(0), B(JumpLoop), U8(108), I8(0),
B(LdaNamedProperty), R(1), U8(12), U8(26), B(LdaNamedProperty), R(1), U8(11), U8(26),
B(Star), R(3), B(Star), R(3),
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
B(TestReferenceEqual), R(2), B(TestReferenceEqual), R(2),
...@@ -321,11 +320,10 @@ bytecodes: [ ...@@ -321,11 +320,10 @@ bytecodes: [
] ]
constant pool: [ constant pool: [
Smi [22], Smi [22],
Smi [179], Smi [178],
Smi [10], Smi [10],
Smi [7], Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
Smi [11], Smi [11],
Smi [29], Smi [29],
......
...@@ -94,7 +94,7 @@ snippet: " ...@@ -94,7 +94,7 @@ snippet: "
" "
frame size: 10 frame size: 10
parameter count: 1 parameter count: 1
bytecode array length: 131 bytecode array length: 130
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
B(CreateBlockContext), U8(0), B(CreateBlockContext), U8(0),
...@@ -117,22 +117,22 @@ bytecodes: [ ...@@ -117,22 +117,22 @@ bytecodes: [
B(Star), R(3), B(Star), R(3),
/* 101 S> */ B(CreateArrayLiteral), U8(5), U8(1), U8(37), /* 101 S> */ B(CreateArrayLiteral), U8(5), U8(1), U8(37),
B(Star), R(7), B(Star), R(7),
B(LdaNamedProperty), R(7), U8(6), U8(2), B(GetIterator), R(7), U8(2),
B(Star), R(8), B(Star), R(8),
B(CallProperty0), R(8), R(7), U8(4), B(CallProperty0), R(8), R(7), U8(4),
B(Mov), R(5), R(2), B(Mov), R(5), R(2),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(6), B(Star), R(6),
B(LdaNamedProperty), R(6), U8(7), U8(6), B(LdaNamedProperty), R(6), U8(6), U8(6),
B(Star), R(5), B(Star), R(5),
B(CallProperty0), R(5), R(6), U8(15), B(CallProperty0), R(5), R(6), U8(15),
B(Star), R(9), B(Star), R(9),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1),
B(LdaNamedProperty), R(9), U8(8), U8(17), B(LdaNamedProperty), R(9), U8(7), U8(17),
B(JumpIfToBooleanTrue), U8(19), B(JumpIfToBooleanTrue), U8(19),
B(LdaNamedProperty), R(9), U8(9), U8(8), B(LdaNamedProperty), R(9), U8(8), U8(8),
B(StaInArrayLiteral), R(4), R(3), U8(13), B(StaInArrayLiteral), R(4), R(3), U8(13),
B(Ldar), R(3), B(Ldar), R(3),
B(Inc), U8(12), B(Inc), U8(12),
...@@ -152,7 +152,6 @@ constant pool: [ ...@@ -152,7 +152,6 @@ constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
Smi [1], Smi [1],
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
......
...@@ -93,7 +93,7 @@ snippet: " ...@@ -93,7 +93,7 @@ snippet: "
" "
frame size: 13 frame size: 13
parameter count: 1 parameter count: 1
bytecode array length: 128 bytecode array length: 127
bytecodes: [ bytecodes: [
B(CreateRestParameter), B(CreateRestParameter),
B(Star), R(3), B(Star), R(3),
...@@ -111,7 +111,7 @@ bytecodes: [ ...@@ -111,7 +111,7 @@ bytecodes: [
B(Ldar), R(6), B(Ldar), R(6),
B(Inc), U8(3), B(Inc), U8(3),
/* 152 S> */ B(Star), R(6), /* 152 S> */ B(Star), R(6),
B(LdaNamedProperty), R(3), U8(0), U8(4), B(GetIterator), R(3), U8(4),
B(Star), R(11), B(Star), R(11),
B(CallProperty0), R(11), R(3), U8(6), B(CallProperty0), R(11), R(3), U8(6),
B(Mov), R(3), R(10), B(Mov), R(3), R(10),
...@@ -119,15 +119,15 @@ bytecodes: [ ...@@ -119,15 +119,15 @@ bytecodes: [
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(9), B(Star), R(9),
B(LdaNamedProperty), R(9), U8(1), U8(8), B(LdaNamedProperty), R(9), U8(0), U8(8),
B(Star), R(8), B(Star), R(8),
B(CallProperty0), R(8), R(9), U8(14), B(CallProperty0), R(8), R(9), U8(14),
B(Star), R(12), B(Star), R(12),
B(JumpIfJSReceiver), U8(7), B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(2), U8(16), B(LdaNamedProperty), R(12), U8(1), U8(16),
B(JumpIfToBooleanTrue), U8(19), B(JumpIfToBooleanTrue), U8(19),
B(LdaNamedProperty), R(12), U8(3), U8(10), B(LdaNamedProperty), R(12), U8(2), U8(10),
B(StaInArrayLiteral), R(7), R(6), U8(1), B(StaInArrayLiteral), R(7), R(6), U8(1),
B(Ldar), R(6), B(Ldar), R(6),
B(Inc), U8(3), B(Inc), U8(3),
...@@ -147,7 +147,6 @@ bytecodes: [ ...@@ -147,7 +147,6 @@ bytecodes: [
/* 162 S> */ B(Return), /* 162 S> */ B(Return),
] ]
constant pool: [ constant pool: [
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
......
...@@ -151,6 +151,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { ...@@ -151,6 +151,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.StoreNamedOwnProperty(reg, name, store_own_slot.ToInt()) .StoreNamedOwnProperty(reg, name, store_own_slot.ToInt())
.StoreInArrayLiteral(reg, reg, store_array_element_slot.ToInt()); .StoreInArrayLiteral(reg, reg, store_array_element_slot.ToInt());
// Emit Iterator-protocol operations
builder.GetIterator(reg, load_slot.ToInt());
// Emit load / store lookup slots. // Emit load / store lookup slots.
builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadLookupSlot(name, TypeofMode::INSIDE_TYPEOF) .LoadLookupSlot(name, TypeofMode::INSIDE_TYPEOF)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment