| 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 |
| 423 InterpreterDispatchDescriptor descriptor(isolate()); | 429 InterpreterDispatchDescriptor descriptor(isolate()); |
| 424 Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), | 430 Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), |
| 425 new_bytecode_offset, BytecodeArrayTaggedPointer(), | 431 bytecode_offset, BytecodeArrayTaggedPointer(), |
| 426 DispatchTableRawPointer(), GetContext()}; | 432 DispatchTableRawPointer(), GetContext()}; |
| 427 TailCall(descriptor, target_code_object, args, 0); | 433 TailCall(descriptor, handler, args, 0); |
| 428 } | 434 } |
| 429 | 435 |
| 430 void InterpreterAssembler::InterpreterReturn() { | 436 void InterpreterAssembler::InterpreterReturn() { |
| 431 if (FLAG_trace_ignition) { | |
| 432 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); | |
| 433 } | |
| 434 InterpreterDispatchDescriptor descriptor(isolate()); | |
| 435 Node* exit_trampoline_code_object = | 437 Node* exit_trampoline_code_object = |
| 436 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); | 438 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); |
| 437 Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), | 439 DispatchToBytecodeHandler(exit_trampoline_code_object); |
| 438 BytecodeOffset(), BytecodeArrayTaggedPointer(), | |
| 439 DispatchTableRawPointer(), GetContext()}; | |
| 440 TailCall(descriptor, exit_trampoline_code_object, args, 0); | |
| 441 } | 440 } |
| 442 | 441 |
| 443 void InterpreterAssembler::StackCheck() { | 442 void InterpreterAssembler::StackCheck() { |
| 444 CodeStubAssembler::Label end(this); | 443 CodeStubAssembler::Label end(this); |
| 445 CodeStubAssembler::Label ok(this); | 444 CodeStubAssembler::Label ok(this); |
| 446 CodeStubAssembler::Label stack_guard(this); | 445 CodeStubAssembler::Label stack_guard(this); |
| 447 | 446 |
| 448 Node* sp = LoadStackPointer(); | 447 Node* sp = LoadStackPointer(); |
| 449 Node* stack_limit = Load( | 448 Node* stack_limit = Load( |
| 450 MachineType::Pointer(), | 449 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 | 493 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87 |
| 495 return true; | 494 return true; |
| 496 #else | 495 #else |
| 497 #error "Unknown Architecture" | 496 #error "Unknown Architecture" |
| 498 #endif | 497 #endif |
| 499 } | 498 } |
| 500 | 499 |
| 501 } // namespace interpreter | 500 } // namespace interpreter |
| 502 } // namespace internal | 501 } // namespace internal |
| 503 } // namespace v8 | 502 } // namespace v8 |
| OLD | NEW |