Index: src/compiler/interpreter-assembler.cc |
diff --git a/src/compiler/interpreter-assembler.cc b/src/compiler/interpreter-assembler.cc |
index f981a4f6751442c2573887b82cf098c05f05939e..edd292b70310ef4d9d1253e6df41c86b70532eee 100644 |
--- a/src/compiler/interpreter-assembler.cc |
+++ b/src/compiler/interpreter-assembler.cc |
@@ -187,12 +187,45 @@ Node* InterpreterAssembler::SmiUntag(Node* value) { |
} |
+Node* InterpreterAssembler::LoadObjectField(Node* object, int offset) { |
+ return raw_assembler_->Load(kMachAnyTagged, object, |
+ IntPtrConstant(offset - kHeapObjectTag)); |
+} |
+ |
+ |
Node* InterpreterAssembler::LoadContextSlot(int slot_index) { |
return raw_assembler_->Load(kMachAnyTagged, ContextTaggedPointer(), |
IntPtrConstant(Context::SlotOffset(slot_index))); |
} |
+Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, |
+ Node* receiver, Node** args, |
+ int arg_count) { |
+ Node* global_object = LoadContextSlot(Context::GLOBAL_OBJECT_INDEX); |
+ Node* builtins_object = |
+ LoadObjectField(global_object, GlobalObject::kBuiltinsOffset); |
+ Node* function = LoadObjectField( |
+ builtins_object, JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); |
+ return raw_assembler_->CallJS(function, receiver, ContextTaggedPointer(), |
+ args, arg_count); |
+} |
+ |
+ |
+Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, |
+ Node* receiver) { |
+ return CallJSBuiltin(builtin, receiver, nullptr, 0); |
+} |
+ |
+ |
+Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, |
+ Node* receiver, Node* arg1) { |
+ Node** args = zone()->NewArray<Node*>(1); |
+ args[0] = arg1; |
+ return CallJSBuiltin(builtin, receiver, args, 1); |
Michael Starzinger
2015/08/19 17:18:56
nit: Shouldn't the following do the trick ...
ret
rmcilroy
2015/08/24 11:49:07
Yup :). Done.
|
+} |
+ |
+ |
void InterpreterAssembler::Return() { |
Node* exit_trampoline_code_object = |
HeapConstant(Unique<HeapObject>::CreateImmovable( |
@@ -278,6 +311,8 @@ Schedule* InterpreterAssembler::schedule() { |
} |
+Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
+ |
} // namespace interpreter |
} // namespace internal |