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/interpreter/interpreter-assembler.h" | 5 #include "src/interpreter/interpreter-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/frames.h" | 10 #include "src/frames.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 void InterpreterAssembler::JumpIfWordNotEqual(Node* lhs, Node* rhs, | 401 void InterpreterAssembler::JumpIfWordNotEqual(Node* lhs, Node* rhs, |
402 Node* delta) { | 402 Node* delta) { |
403 JumpConditional(WordNotEqual(lhs, rhs), delta); | 403 JumpConditional(WordNotEqual(lhs, rhs), delta); |
404 } | 404 } |
405 | 405 |
406 void InterpreterAssembler::Dispatch() { | 406 void InterpreterAssembler::Dispatch() { |
407 DispatchTo(Advance(Bytecodes::Size(bytecode_))); | 407 DispatchTo(Advance(Bytecodes::Size(bytecode_))); |
408 } | 408 } |
409 | 409 |
410 void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) { | 410 void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) { |
411 if (FLAG_trace_ignition) { | |
412 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); | |
413 } | |
414 Node* target_bytecode = Load( | 411 Node* target_bytecode = Load( |
415 MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset); | 412 MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset); |
416 | 413 |
417 // TODO(rmcilroy): Create a code target dispatch table to avoid conversion | 414 // TODO(rmcilroy): Create a code target dispatch table to avoid conversion |
418 // from code object on every dispatch. | 415 // from code object on every dispatch. |
419 Node* target_code_object = | 416 Node* target_code_object = |
420 Load(MachineType::Pointer(), DispatchTableRawPointer(), | 417 Load(MachineType::Pointer(), DispatchTableRawPointer(), |
421 Word32Shl(target_bytecode, Int32Constant(kPointerSizeLog2))); | 418 Word32Shl(target_bytecode, Int32Constant(kPointerSizeLog2))); |
422 | 419 |
420 DispatchToBytecodeHandler(target_code_object, new_bytecode_offset); | |
421 } | |
422 | |
423 void InterpreterAssembler::DispatchToBytecodeHandler(Node* handler, | |
424 Node* bytecode_offset) { | |
425 if (FLAG_trace_ignition) { | |
426 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); | |
427 } | |
428 | |
429 if (bytecode_offset == nullptr) bytecode_offset = BytecodeOffset(); | |
rmcilroy
2016/02/19 14:47:16
Could you avoid this and the default argument type
| |
430 | |
423 InterpreterDispatchDescriptor descriptor(isolate()); | 431 InterpreterDispatchDescriptor descriptor(isolate()); |
424 Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), | 432 Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), |
425 new_bytecode_offset, BytecodeArrayTaggedPointer(), | 433 bytecode_offset, BytecodeArrayTaggedPointer(), |
426 DispatchTableRawPointer(), GetContext()}; | 434 DispatchTableRawPointer(), GetContext()}; |
427 TailCall(descriptor, target_code_object, args, 0); | 435 TailCall(descriptor, handler, args, 0); |
428 } | 436 } |
429 | 437 |
430 void InterpreterAssembler::InterpreterReturn() { | 438 void InterpreterAssembler::InterpreterReturn() { |
431 if (FLAG_trace_ignition) { | |
432 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); | |
433 } | |
434 InterpreterDispatchDescriptor descriptor(isolate()); | |
435 Node* exit_trampoline_code_object = | 439 Node* exit_trampoline_code_object = |
436 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); | 440 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); |
437 Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), | 441 DispatchToBytecodeHandler(exit_trampoline_code_object); |
438 BytecodeOffset(), BytecodeArrayTaggedPointer(), | |
439 DispatchTableRawPointer(), GetContext()}; | |
440 TailCall(descriptor, exit_trampoline_code_object, args, 0); | |
441 } | 442 } |
442 | 443 |
443 void InterpreterAssembler::StackCheck() { | 444 void InterpreterAssembler::StackCheck() { |
444 CodeStubAssembler::Label end(this); | 445 CodeStubAssembler::Label end(this); |
445 CodeStubAssembler::Label ok(this); | 446 CodeStubAssembler::Label ok(this); |
446 CodeStubAssembler::Label stack_guard(this); | 447 CodeStubAssembler::Label stack_guard(this); |
447 | 448 |
448 Node* sp = LoadStackPointer(); | 449 Node* sp = LoadStackPointer(); |
449 Node* stack_limit = Load( | 450 Node* stack_limit = Load( |
450 MachineType::Pointer(), | 451 MachineType::Pointer(), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87 | 495 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87 |
495 return true; | 496 return true; |
496 #else | 497 #else |
497 #error "Unknown Architecture" | 498 #error "Unknown Architecture" |
498 #endif | 499 #endif |
499 } | 500 } |
500 | 501 |
501 } // namespace interpreter | 502 } // namespace interpreter |
502 } // namespace internal | 503 } // namespace internal |
503 } // namespace v8 | 504 } // namespace v8 |
OLD | NEW |