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

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

Issue 2336203002: [Interpreter] Add an unsigned immediate operand type (Closed)
Patch Set: Created 4 years, 3 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
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.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { 513 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) {
514 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); 514 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT);
515 DoStaGlobal(ic, assembler); 515 DoStaGlobal(ic, assembler);
516 } 516 }
517 517
518 compiler::Node* Interpreter::BuildLoadContextSlot( 518 compiler::Node* Interpreter::BuildLoadContextSlot(
519 InterpreterAssembler* assembler) { 519 InterpreterAssembler* assembler) {
520 Node* reg_index = __ BytecodeOperandReg(0); 520 Node* reg_index = __ BytecodeOperandReg(0);
521 Node* context = __ LoadRegister(reg_index); 521 Node* context = __ LoadRegister(reg_index);
522 Node* slot_index = __ BytecodeOperandIdx(1); 522 Node* slot_index = __ BytecodeOperandIdx(1);
523 Node* depth = __ BytecodeOperandIdx(2); 523 Node* depth = __ BytecodeOperandUImm(2);
524 Node* slot_context = __ GetContextAtDepth(context, depth); 524 Node* slot_context = __ GetContextAtDepth(context, depth);
525 return __ LoadContextSlot(slot_context, slot_index); 525 return __ LoadContextSlot(slot_context, slot_index);
526 } 526 }
527 527
528 // LdaContextSlot <context> <slot_index> <depth> 528 // LdaContextSlot <context> <slot_index> <depth>
529 // 529 //
530 // Load the object in |slot_index| of the context at |depth| in the context 530 // Load the object in |slot_index| of the context at |depth| in the context
531 // chain starting at |context| into the accumulator. 531 // chain starting at |context| into the accumulator.
532 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { 532 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) {
533 Node* result = BuildLoadContextSlot(assembler); 533 Node* result = BuildLoadContextSlot(assembler);
(...skipping 14 matching lines...) Expand all
548 548
549 // StaContextSlot <context> <slot_index> <depth> 549 // StaContextSlot <context> <slot_index> <depth>
550 // 550 //
551 // Stores the object in the accumulator into |slot_index| of the context at 551 // Stores the object in the accumulator into |slot_index| of the context at
552 // |depth| in the context chain starting at |context|. 552 // |depth| in the context chain starting at |context|.
553 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { 553 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) {
554 Node* value = __ GetAccumulator(); 554 Node* value = __ GetAccumulator();
555 Node* reg_index = __ BytecodeOperandReg(0); 555 Node* reg_index = __ BytecodeOperandReg(0);
556 Node* context = __ LoadRegister(reg_index); 556 Node* context = __ LoadRegister(reg_index);
557 Node* slot_index = __ BytecodeOperandIdx(1); 557 Node* slot_index = __ BytecodeOperandIdx(1);
558 Node* depth = __ BytecodeOperandIdx(2); 558 Node* depth = __ BytecodeOperandUImm(2);
559 Node* slot_context = __ GetContextAtDepth(context, depth); 559 Node* slot_context = __ GetContextAtDepth(context, depth);
560 __ StoreContextSlot(slot_context, slot_index, value); 560 __ StoreContextSlot(slot_context, slot_index, value);
561 __ Dispatch(); 561 __ Dispatch();
562 } 562 }
563 563
564 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id, 564 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id,
565 InterpreterAssembler* assembler) { 565 InterpreterAssembler* assembler) {
566 Node* index = __ BytecodeOperandIdx(0); 566 Node* index = __ BytecodeOperandIdx(0);
567 Node* name = __ LoadConstantPoolEntry(index); 567 Node* name = __ LoadConstantPoolEntry(index);
568 Node* context = __ GetContext(); 568 Node* context = __ GetContext();
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 __ SetAccumulator(__ CallRuntime(Runtime::kPushCatchContext, context, name, 2003 __ SetAccumulator(__ CallRuntime(Runtime::kPushCatchContext, context, name,
2004 exception, scope_info, closure)); 2004 exception, scope_info, closure));
2005 __ Dispatch(); 2005 __ Dispatch();
2006 } 2006 }
2007 2007
2008 // CreateFunctionContext <slots> 2008 // CreateFunctionContext <slots>
2009 // 2009 //
2010 // Creates a new context with number of |slots| for the function closure. 2010 // Creates a new context with number of |slots| for the function closure.
2011 void Interpreter::DoCreateFunctionContext(InterpreterAssembler* assembler) { 2011 void Interpreter::DoCreateFunctionContext(InterpreterAssembler* assembler) {
2012 Node* closure = __ LoadRegister(Register::function_closure()); 2012 Node* closure = __ LoadRegister(Register::function_closure());
2013 Node* slots = __ BytecodeOperandIdx(0); 2013 Node* slots = __ BytecodeOperandIdx(0);
klaasb 2016/09/13 10:54:40 Please also change to UImm here.
rmcilroy 2016/09/13 12:05:57 +1. This should cause a DCHECK in debug mode as-is
Leszek Swirski 2016/09/13 14:03:23 Done, and I ran the tests in debug this time to ch
2014 Node* context = __ GetContext(); 2014 Node* context = __ GetContext();
2015 __ SetAccumulator( 2015 __ SetAccumulator(
2016 FastNewFunctionContextStub::Generate(assembler, closure, slots, context)); 2016 FastNewFunctionContextStub::Generate(assembler, closure, slots, context));
2017 __ Dispatch(); 2017 __ Dispatch();
2018 } 2018 }
2019 2019
2020 // CreateWithContext <register> <scope_info_idx> 2020 // CreateWithContext <register> <scope_info_idx>
2021 // 2021 //
2022 // Creates a new context with the ScopeInfo at |scope_info_idx| for a 2022 // Creates a new context with the ScopeInfo at |scope_info_idx| for a
2023 // with-statement with the object in |register| and the closure in the 2023 // with-statement with the object in |register| and the closure in the
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2463 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2464 __ SmiTag(new_state)); 2464 __ SmiTag(new_state));
2465 __ SetAccumulator(old_state); 2465 __ SetAccumulator(old_state);
2466 2466
2467 __ Dispatch(); 2467 __ Dispatch();
2468 } 2468 }
2469 2469
2470 } // namespace interpreter 2470 } // namespace interpreter
2471 } // namespace internal 2471 } // namespace internal
2472 } // namespace v8 2472 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698