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

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

Issue 1402943002: [Interpreter] Support for operator new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate review comments on patch sets 2 and 3. Created 5 years, 2 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 "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/interpreter-assembler.h" 9 #include "src/compiler/interpreter-assembler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 Node* function_id = __ BytecodeOperandIdx16(0); 507 Node* function_id = __ BytecodeOperandIdx16(0);
508 Node* first_arg_reg = __ BytecodeOperandReg8(1); 508 Node* first_arg_reg = __ BytecodeOperandReg8(1);
509 Node* first_arg = __ RegisterLocation(first_arg_reg); 509 Node* first_arg = __ RegisterLocation(first_arg_reg);
510 Node* args_count = __ BytecodeOperandCount8(2); 510 Node* args_count = __ BytecodeOperandCount8(2);
511 Node* result = __ CallRuntime(function_id, first_arg, args_count); 511 Node* result = __ CallRuntime(function_id, first_arg, args_count);
512 __ SetAccumulator(result); 512 __ SetAccumulator(result);
513 __ Dispatch(); 513 __ Dispatch();
514 } 514 }
515 515
516 516
517 // New <constructor> <arg_count>
518 //
519 // Call operator new with |constructor| and the first argument in
520 // register |first_arg| and |arg_count| arguments in subsequent
521 //
522 void Interpreter::DoNew(compiler::InterpreterAssembler* assembler) {
523 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_);
524 Node* constructor_index = __ BytecodeOperandReg8(0);
525 Node* constructor = __ LoadRegister(constructor_index);
526 Node* first_arg_reg = __ BytecodeOperandReg8(1);
527 Node* first_arg = __ RegisterLocation(first_arg_reg);
528 Node* args_count = __ BytecodeOperandCount8(2);
529 Node* result =
530 __ CallConstruct(constructor, constructor, first_arg, args_count);
531 __ SetAccumulator(result);
532 __ Dispatch();
533 }
534
535
517 // TestEqual <src> 536 // TestEqual <src>
518 // 537 //
519 // Test if the value in the <src> register equals the accumulator. 538 // Test if the value in the <src> register equals the accumulator.
520 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { 539 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) {
521 DoBinaryOp(Runtime::kInterpreterEquals, assembler); 540 DoBinaryOp(Runtime::kInterpreterEquals, assembler);
522 } 541 }
523 542
524 543
525 // TestNotEqual <src> 544 // TestNotEqual <src>
526 // 545 //
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 // 727 //
709 // Return the value in the accumulator. 728 // Return the value in the accumulator.
710 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 729 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
711 __ Return(); 730 __ Return();
712 } 731 }
713 732
714 733
715 } // namespace interpreter 734 } // namespace interpreter
716 } // namespace internal 735 } // namespace internal
717 } // namespace v8 736 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698