Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: src/compiler/interpreter-assembler.cc

Issue 1300813005: [Interpreter] Add implementations of arithmetic binary op bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mstar_v8h
Patch Set: Fix unittest too... Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/interpreter-assembler.cc
diff --git a/src/compiler/interpreter-assembler.cc b/src/compiler/interpreter-assembler.cc
index f981a4f6751442c2573887b82cf098c05f05939e..e3401fb9fbc285d2f9a927424063e2e4c850cbd6 100644
--- a/src/compiler/interpreter-assembler.cc
+++ b/src/compiler/interpreter-assembler.cc
@@ -187,12 +187,54 @@ 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** js_args,
+ int js_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));
+ Node* context = LoadObjectField(function, JSFunction::kContextOffset);
+
+ int index = 0;
+ Node** args = zone()->NewArray<Node*>(js_arg_count + 2);
+ args[index++] = receiver;
+ for (int i = 0; i < js_arg_count; i++) {
+ args[index++] = js_args[i];
+ }
+ args[index++] = context;
+
+ CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
+ zone(), false, js_arg_count + 1, CallDescriptor::kNoFlags);
+ return raw_assembler_->CallN(descriptor, function, args);
+}
+
+
+Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin,
+ Node* receiver) {
+ return CallJSBuiltin(builtin, receiver, nullptr, 0);
+}
+
+
+Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin,
+ Node* receiver, Node* arg1) {
+ return CallJSBuiltin(builtin, receiver, &arg1, 1);
+}
+
+
void InterpreterAssembler::Return() {
Node* exit_trampoline_code_object =
HeapConstant(Unique<HeapObject>::CreateImmovable(
@@ -204,10 +246,14 @@ void InterpreterAssembler::Return() {
STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter);
STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter);
STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter);
- Node* tail_call = raw_assembler_->TailCallInterpreterDispatch(
- call_descriptor(), exit_trampoline_code_object, GetAccumulator(),
- RegisterFileRawPointer(), BytecodeOffset(), BytecodeArrayTaggedPointer(),
- DispatchTableRawPointer(), ContextTaggedPointer());
+ Node* args[] = { GetAccumulator(),
+ RegisterFileRawPointer(),
+ BytecodeOffset(),
+ BytecodeArrayTaggedPointer(),
+ DispatchTableRawPointer(),
+ ContextTaggedPointer() };
+ Node* tail_call = raw_assembler_->TailCallN(
+ call_descriptor(), exit_trampoline_code_object, args);
// This should always be the end node.
SetEndInput(tail_call);
}
@@ -237,11 +283,14 @@ void InterpreterAssembler::Dispatch() {
STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter);
STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter);
STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter);
- Node* tail_call = raw_assembler_->TailCallInterpreterDispatch(
- call_descriptor(), target_code_object, GetAccumulator(),
- RegisterFileRawPointer(), new_bytecode_offset,
- BytecodeArrayTaggedPointer(), DispatchTableRawPointer(),
- ContextTaggedPointer());
+ Node* args[] = { GetAccumulator(),
+ RegisterFileRawPointer(),
+ new_bytecode_offset,
+ BytecodeArrayTaggedPointer(),
+ DispatchTableRawPointer(),
+ ContextTaggedPointer() };
+ Node* tail_call =
+ raw_assembler_->TailCallN(call_descriptor(), target_code_object, args);
// This should always be the end node.
SetEndInput(tail_call);
}
@@ -278,6 +327,8 @@ Schedule* InterpreterAssembler::schedule() {
}
+Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); }
+
} // namespace interpreter
} // namespace internal
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698