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

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

Issue 1699013002: [Interpreter] Push BytecodeArray onto interpreted stack frames. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Modify EnterBytecodeDispatch too Created 4 years, 10 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') | src/mips/builtins-mips.cc » ('j') | 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 <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 10 matching lines...) Expand all
21 using compiler::Node; 21 using compiler::Node;
22 22
23 InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, 23 InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
24 Bytecode bytecode) 24 Bytecode bytecode)
25 : compiler::CodeStubAssembler( 25 : compiler::CodeStubAssembler(
26 isolate, zone, InterpreterDispatchDescriptor(isolate), 26 isolate, zone, InterpreterDispatchDescriptor(isolate),
27 Code::ComputeFlags(Code::STUB), Bytecodes::ToString(bytecode), 0), 27 Code::ComputeFlags(Code::STUB), Bytecodes::ToString(bytecode), 0),
28 bytecode_(bytecode), 28 bytecode_(bytecode),
29 accumulator_(this, MachineRepresentation::kTagged), 29 accumulator_(this, MachineRepresentation::kTagged),
30 context_(this, MachineRepresentation::kTagged), 30 context_(this, MachineRepresentation::kTagged),
31 dispatch_table_(this, MachineType::PointerRepresentation()), 31 bytecode_array_(this, MachineRepresentation::kTagged),
32 disable_stack_check_across_call_(false), 32 disable_stack_check_across_call_(false),
33 stack_pointer_before_call_(nullptr) { 33 stack_pointer_before_call_(nullptr) {
34 accumulator_.Bind( 34 accumulator_.Bind(
35 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); 35 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
36 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter)); 36 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter));
37 dispatch_table_.Bind( 37 bytecode_array_.Bind(
38 Parameter(InterpreterDispatchDescriptor::kDispatchTableParameter)); 38 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter));
39 if (FLAG_trace_ignition) { 39 if (FLAG_trace_ignition) {
40 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); 40 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
41 } 41 }
42 } 42 }
43 43
44 InterpreterAssembler::~InterpreterAssembler() {} 44 InterpreterAssembler::~InterpreterAssembler() {}
45 45
46 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); } 46 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); }
47 47
48 void InterpreterAssembler::SetAccumulator(Node* value) { 48 void InterpreterAssembler::SetAccumulator(Node* value) {
49 accumulator_.Bind(value); 49 accumulator_.Bind(value);
50 } 50 }
51 51
52 Node* InterpreterAssembler::GetContext() { return context_.value(); } 52 Node* InterpreterAssembler::GetContext() { return context_.value(); }
53 53
54 void InterpreterAssembler::SetContext(Node* value) { 54 void InterpreterAssembler::SetContext(Node* value) {
55 StoreRegister(value, Register::current_context()); 55 StoreRegister(value, Register::current_context());
56 context_.Bind(value); 56 context_.Bind(value);
57 } 57 }
58 58
59 Node* InterpreterAssembler::BytecodeOffset() { 59 Node* InterpreterAssembler::BytecodeOffset() {
60 return Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter); 60 return Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter);
61 } 61 }
62 62
63 Node* InterpreterAssembler::RegisterFileRawPointer() { 63 Node* InterpreterAssembler::RegisterFileRawPointer() {
64 return Parameter(InterpreterDispatchDescriptor::kRegisterFileParameter); 64 return Parameter(InterpreterDispatchDescriptor::kRegisterFileParameter);
65 } 65 }
66 66
67 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { 67 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
68 return Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter); 68 return bytecode_array_.value();
69 } 69 }
70 70
71 Node* InterpreterAssembler::DispatchTableRawPointer() { 71 Node* InterpreterAssembler::DispatchTableRawPointer() {
72 return dispatch_table_.value(); 72 return Parameter(InterpreterDispatchDescriptor::kDispatchTableParameter);
73 } 73 }
74 74
75 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { 75 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
76 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index)); 76 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index));
77 } 77 }
78 78
79 Node* InterpreterAssembler::LoadRegister(int offset) { 79 Node* InterpreterAssembler::LoadRegister(int offset) {
80 return Load(MachineType::AnyTagged(), RegisterFileRawPointer(), 80 return Load(MachineType::AnyTagged(), RegisterFileRawPointer(),
81 Int32Constant(offset)); 81 Int32Constant(offset));
82 } 82 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 Node* shared_info = 303 Node* shared_info =
304 LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset); 304 LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset);
305 Node* vector = 305 Node* vector =
306 LoadObjectField(shared_info, SharedFunctionInfo::kFeedbackVectorOffset); 306 LoadObjectField(shared_info, SharedFunctionInfo::kFeedbackVectorOffset);
307 return vector; 307 return vector;
308 } 308 }
309 309
310 void InterpreterAssembler::CallPrologue() { 310 void InterpreterAssembler::CallPrologue() {
311 StoreRegister(SmiTag(BytecodeOffset()), 311 StoreRegister(SmiTag(BytecodeOffset()),
312 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer); 312 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer);
313 StoreRegister(DispatchTableRawPointer(), 313 StoreRegister(BytecodeArrayTaggedPointer(),
314 InterpreterFrameConstants::kDispatchTableFromRegisterPointer); 314 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer);
315 315
316 if (FLAG_debug_code && !disable_stack_check_across_call_) { 316 if (FLAG_debug_code && !disable_stack_check_across_call_) {
317 DCHECK(stack_pointer_before_call_ == nullptr); 317 DCHECK(stack_pointer_before_call_ == nullptr);
318 stack_pointer_before_call_ = LoadStackPointer(); 318 stack_pointer_before_call_ = LoadStackPointer();
319 } 319 }
320 } 320 }
321 321
322 void InterpreterAssembler::CallEpilogue() { 322 void InterpreterAssembler::CallEpilogue() {
323 if (FLAG_debug_code && !disable_stack_check_across_call_) { 323 if (FLAG_debug_code && !disable_stack_check_across_call_) {
324 Node* stack_pointer_after_call = LoadStackPointer(); 324 Node* stack_pointer_after_call = LoadStackPointer();
325 Node* stack_pointer_before_call = stack_pointer_before_call_; 325 Node* stack_pointer_before_call = stack_pointer_before_call_;
326 stack_pointer_before_call_ = nullptr; 326 stack_pointer_before_call_ = nullptr;
327 AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call, 327 AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call,
328 kUnexpectedStackPointer); 328 kUnexpectedStackPointer);
329 } 329 }
330 330
331 // Restore dispatch table from stack frame in case the debugger has swapped us 331 // Restore bytecode array from stack frame in case the debugger has swapped us
332 // to the debugger dispatch table. 332 // to the patched debugger bytecode array.
333 dispatch_table_.Bind(LoadRegister( 333 bytecode_array_.Bind(LoadRegister(
334 InterpreterFrameConstants::kDispatchTableFromRegisterPointer)); 334 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
335 } 335 }
336 336
337 Node* InterpreterAssembler::CallJS(Node* function, Node* context, 337 Node* InterpreterAssembler::CallJS(Node* function, Node* context,
338 Node* first_arg, Node* arg_count) { 338 Node* first_arg, Node* arg_count) {
339 Callable callable = CodeFactory::InterpreterPushArgsAndCall(isolate()); 339 Callable callable = CodeFactory::InterpreterPushArgsAndCall(isolate());
340 Node* code_target = HeapConstant(callable.code()); 340 Node* code_target = HeapConstant(callable.code());
341 return CallStub(callable.descriptor(), code_target, context, arg_count, 341 return CallStub(callable.descriptor(), code_target, context, arg_count,
342 first_arg, function); 342 first_arg, function);
343 } 343 }
344 344
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87 492 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87
493 return true; 493 return true;
494 #else 494 #else
495 #error "Unknown Architecture" 495 #error "Unknown Architecture"
496 #endif 496 #endif
497 } 497 }
498 498
499 } // namespace interpreter 499 } // namespace interpreter
500 } // namespace internal 500 } // namespace internal
501 } // namespace v8 501 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698