Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/interpreter-assembler.h" | 5 #include "src/compiler/interpreter-assembler.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/instruction-selector.h" | 10 #include "src/compiler/instruction-selector.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 Node* InterpreterAssembler::SmiTag(Node* value) { | 180 Node* InterpreterAssembler::SmiTag(Node* value) { |
| 181 return raw_assembler_->WordShl(value, SmiShiftBitsConstant()); | 181 return raw_assembler_->WordShl(value, SmiShiftBitsConstant()); |
| 182 } | 182 } |
| 183 | 183 |
| 184 | 184 |
| 185 Node* InterpreterAssembler::SmiUntag(Node* value) { | 185 Node* InterpreterAssembler::SmiUntag(Node* value) { |
| 186 return raw_assembler_->WordSar(value, SmiShiftBitsConstant()); | 186 return raw_assembler_->WordSar(value, SmiShiftBitsConstant()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 Node* InterpreterAssembler::LoadObjectField(Node* object, int offset) { | |
| 191 return raw_assembler_->Load(kMachAnyTagged, object, | |
| 192 IntPtrConstant(offset - kHeapObjectTag)); | |
| 193 } | |
| 194 | |
| 195 | |
| 190 Node* InterpreterAssembler::LoadContextSlot(int slot_index) { | 196 Node* InterpreterAssembler::LoadContextSlot(int slot_index) { |
| 191 return raw_assembler_->Load(kMachAnyTagged, ContextTaggedPointer(), | 197 return raw_assembler_->Load(kMachAnyTagged, ContextTaggedPointer(), |
| 192 IntPtrConstant(Context::SlotOffset(slot_index))); | 198 IntPtrConstant(Context::SlotOffset(slot_index))); |
| 193 } | 199 } |
| 194 | 200 |
| 195 | 201 |
| 202 Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, | |
| 203 Node* receiver, Node** args, | |
| 204 int arg_count) { | |
| 205 Node* global_object = LoadContextSlot(Context::GLOBAL_OBJECT_INDEX); | |
| 206 Node* builtins_object = | |
| 207 LoadObjectField(global_object, GlobalObject::kBuiltinsOffset); | |
| 208 Node* function = LoadObjectField( | |
| 209 builtins_object, JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); | |
| 210 return raw_assembler_->CallJS(function, receiver, ContextTaggedPointer(), | |
| 211 args, arg_count); | |
| 212 } | |
| 213 | |
| 214 | |
| 215 Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, | |
| 216 Node* receiver) { | |
| 217 return CallJSBuiltin(builtin, receiver, nullptr, 0); | |
| 218 } | |
| 219 | |
| 220 | |
| 221 Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, | |
| 222 Node* receiver, Node* arg1) { | |
| 223 Node** args = zone()->NewArray<Node*>(1); | |
| 224 args[0] = arg1; | |
| 225 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.
| |
| 226 } | |
| 227 | |
| 228 | |
| 196 void InterpreterAssembler::Return() { | 229 void InterpreterAssembler::Return() { |
| 197 Node* exit_trampoline_code_object = | 230 Node* exit_trampoline_code_object = |
| 198 HeapConstant(Unique<HeapObject>::CreateImmovable( | 231 HeapConstant(Unique<HeapObject>::CreateImmovable( |
| 199 isolate()->builtins()->InterpreterExitTrampoline())); | 232 isolate()->builtins()->InterpreterExitTrampoline())); |
| 200 // If the order of the parameters you need to change the call signature below. | 233 // If the order of the parameters you need to change the call signature below. |
| 201 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); | 234 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); |
| 202 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); | 235 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); |
| 203 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); | 236 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); |
| 204 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); | 237 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); |
| 205 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); | 238 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 CallDescriptor* InterpreterAssembler::call_descriptor() const { | 304 CallDescriptor* InterpreterAssembler::call_descriptor() const { |
| 272 return raw_assembler_->call_descriptor(); | 305 return raw_assembler_->call_descriptor(); |
| 273 } | 306 } |
| 274 | 307 |
| 275 | 308 |
| 276 Schedule* InterpreterAssembler::schedule() { | 309 Schedule* InterpreterAssembler::schedule() { |
| 277 return raw_assembler_->schedule(); | 310 return raw_assembler_->schedule(); |
| 278 } | 311 } |
| 279 | 312 |
| 280 | 313 |
| 314 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | |
| 315 | |
| 281 | 316 |
| 282 } // namespace interpreter | 317 } // namespace interpreter |
| 283 } // namespace internal | 318 } // namespace internal |
| 284 } // namespace v8 | 319 } // namespace v8 |
| OLD | NEW |