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

Side by Side Diff: src/interpreter/interpreter-assembler.cc

Issue 1895063002: [Interpreter] Avoid binding bytecode_array to a variable in CallEpilogue (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 7 #include <limits>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 15 matching lines...) Expand all
26 Bytecode bytecode, 26 Bytecode bytecode,
27 OperandScale operand_scale) 27 OperandScale operand_scale)
28 : compiler::CodeStubAssembler(isolate, zone, 28 : compiler::CodeStubAssembler(isolate, zone,
29 InterpreterDispatchDescriptor(isolate), 29 InterpreterDispatchDescriptor(isolate),
30 Code::ComputeFlags(Code::BYTECODE_HANDLER), 30 Code::ComputeFlags(Code::BYTECODE_HANDLER),
31 Bytecodes::ToString(bytecode), 0), 31 Bytecodes::ToString(bytecode), 0),
32 bytecode_(bytecode), 32 bytecode_(bytecode),
33 operand_scale_(operand_scale), 33 operand_scale_(operand_scale),
34 accumulator_(this, MachineRepresentation::kTagged), 34 accumulator_(this, MachineRepresentation::kTagged),
35 accumulator_use_(AccumulatorUse::kNone), 35 accumulator_use_(AccumulatorUse::kNone),
36 bytecode_array_(this, MachineRepresentation::kTagged), 36 made_call_(false),
37 disable_stack_check_across_call_(false), 37 disable_stack_check_across_call_(false),
38 stack_pointer_before_call_(nullptr) { 38 stack_pointer_before_call_(nullptr) {
39 accumulator_.Bind( 39 accumulator_.Bind(
40 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); 40 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
41 bytecode_array_.Bind(
42 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter));
43 if (FLAG_trace_ignition) { 41 if (FLAG_trace_ignition) {
44 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); 42 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
45 } 43 }
46 } 44 }
47 45
48 InterpreterAssembler::~InterpreterAssembler() { 46 InterpreterAssembler::~InterpreterAssembler() {
49 // If the following check fails the handler does not use the 47 // If the following check fails the handler does not use the
50 // accumulator in the way described in the bytecode definitions in 48 // accumulator in the way described in the bytecode definitions in
51 // bytecodes.h. 49 // bytecodes.h.
52 DCHECK_EQ(accumulator_use_, Bytecodes::GetAccumulatorUse(bytecode_)); 50 DCHECK_EQ(accumulator_use_, Bytecodes::GetAccumulatorUse(bytecode_));
(...skipping 25 matching lines...) Expand all
78 76
79 Node* InterpreterAssembler::BytecodeOffset() { 77 Node* InterpreterAssembler::BytecodeOffset() {
80 return Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter); 78 return Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter);
81 } 79 }
82 80
83 Node* InterpreterAssembler::RegisterFileRawPointer() { 81 Node* InterpreterAssembler::RegisterFileRawPointer() {
84 return Parameter(InterpreterDispatchDescriptor::kRegisterFileParameter); 82 return Parameter(InterpreterDispatchDescriptor::kRegisterFileParameter);
85 } 83 }
86 84
87 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { 85 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
88 return bytecode_array_.value(); 86 if (made_call_) {
87 // If we have made a call, restore bytecode array from stack frame in case
88 // the debugger has swapped us to the patched debugger bytecode array.
89 return LoadRegister(
epertoso 2016/04/18 14:23:27 You probably want to reset made_call_ to false her
rmcilroy 2016/04/18 14:59:15 No I don't think so, if we did that then if there
90 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer);
91 } else {
92 return Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter);
93 }
89 } 94 }
90 95
91 Node* InterpreterAssembler::DispatchTableRawPointer() { 96 Node* InterpreterAssembler::DispatchTableRawPointer() {
92 return Parameter(InterpreterDispatchDescriptor::kDispatchTableParameter); 97 return Parameter(InterpreterDispatchDescriptor::kDispatchTableParameter);
93 } 98 }
94 99
95 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { 100 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
96 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index)); 101 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index));
97 } 102 }
98 103
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 422 }
418 423
419 void InterpreterAssembler::CallPrologue() { 424 void InterpreterAssembler::CallPrologue() {
420 StoreRegister(SmiTag(BytecodeOffset()), 425 StoreRegister(SmiTag(BytecodeOffset()),
421 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer); 426 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer);
422 427
423 if (FLAG_debug_code && !disable_stack_check_across_call_) { 428 if (FLAG_debug_code && !disable_stack_check_across_call_) {
424 DCHECK(stack_pointer_before_call_ == nullptr); 429 DCHECK(stack_pointer_before_call_ == nullptr);
425 stack_pointer_before_call_ = LoadStackPointer(); 430 stack_pointer_before_call_ = LoadStackPointer();
426 } 431 }
432 made_call_ = true;
427 } 433 }
428 434
429 void InterpreterAssembler::CallEpilogue() { 435 void InterpreterAssembler::CallEpilogue() {
430 if (FLAG_debug_code && !disable_stack_check_across_call_) { 436 if (FLAG_debug_code && !disable_stack_check_across_call_) {
431 Node* stack_pointer_after_call = LoadStackPointer(); 437 Node* stack_pointer_after_call = LoadStackPointer();
432 Node* stack_pointer_before_call = stack_pointer_before_call_; 438 Node* stack_pointer_before_call = stack_pointer_before_call_;
433 stack_pointer_before_call_ = nullptr; 439 stack_pointer_before_call_ = nullptr;
434 AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call, 440 AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call,
435 kUnexpectedStackPointer); 441 kUnexpectedStackPointer);
436 } 442 }
437
438 // Restore bytecode array from stack frame in case the debugger has swapped us
439 // to the patched debugger bytecode array.
440 bytecode_array_.Bind(LoadRegister(
441 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
442 } 443 }
443 444
444 Node* InterpreterAssembler::CallJS(Node* function, Node* context, 445 Node* InterpreterAssembler::CallJS(Node* function, Node* context,
445 Node* first_arg, Node* arg_count, 446 Node* first_arg, Node* arg_count,
446 TailCallMode tail_call_mode) { 447 TailCallMode tail_call_mode) {
447 Callable callable = 448 Callable callable =
448 CodeFactory::InterpreterPushArgsAndCall(isolate(), tail_call_mode); 449 CodeFactory::InterpreterPushArgsAndCall(isolate(), tail_call_mode);
449 Node* code_target = HeapConstant(callable.code()); 450 Node* code_target = HeapConstant(callable.code());
450 return CallStub(callable.descriptor(), code_target, context, arg_count, 451 return CallStub(callable.descriptor(), code_target, context, arg_count,
451 first_arg, function); 452 first_arg, function);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 V8_TARGET_ARCH_S390 727 V8_TARGET_ARCH_S390
727 return true; 728 return true;
728 #else 729 #else
729 #error "Unknown Architecture" 730 #error "Unknown Architecture"
730 #endif 731 #endif
731 } 732 }
732 733
733 } // namespace interpreter 734 } // namespace interpreter
734 } // namespace internal 735 } // namespace internal
735 } // namespace v8 736 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698