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

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

Issue 1474103002: Re-reland "[Interpreter] Add CreateClosure to BytecodeGraphBuilder." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/bytecodes.h ('k') | test/cctest/compiler/test-run-bytecode-graph-builder.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.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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 // CreateObjectLiteral <idx> <flags> 1349 // CreateObjectLiteral <idx> <flags>
1350 // 1350 //
1351 // Creates an object literal for literal index <idx> with flags <flags> and 1351 // Creates an object literal for literal index <idx> with flags <flags> and
1352 // constant elements in the accumulator. 1352 // constant elements in the accumulator.
1353 void Interpreter::DoCreateObjectLiteral( 1353 void Interpreter::DoCreateObjectLiteral(
1354 compiler::InterpreterAssembler* assembler) { 1354 compiler::InterpreterAssembler* assembler) {
1355 DoCreateLiteral(Runtime::kCreateObjectLiteral, assembler); 1355 DoCreateLiteral(Runtime::kCreateObjectLiteral, assembler);
1356 } 1356 }
1357 1357
1358 1358
1359 // CreateClosure <tenured> 1359 // CreateClosure <index> <tenured>
1360 // 1360 //
1361 // Creates a new closure for SharedFunctionInfo in the accumulator with the 1361 // Creates a new closure for SharedFunctionInfo at position |index| in the
1362 // PretenureFlag <tenured>. 1362 // constant pool and with the PretenureFlag <tenured>.
1363 void Interpreter::DoCreateClosure(compiler::InterpreterAssembler* assembler) { 1363 void Interpreter::DoCreateClosure(compiler::InterpreterAssembler* assembler) {
1364 // TODO(rmcilroy): Possibly call FastNewClosureStub when possible instead of 1364 // TODO(rmcilroy): Possibly call FastNewClosureStub when possible instead of
1365 // calling into the runtime. 1365 // calling into the runtime.
1366 Node* shared = __ GetAccumulator(); 1366 Node* index = __ BytecodeOperandIdx(0);
1367 Node* tenured_raw = __ BytecodeOperandImm(0); 1367 Node* shared = __ LoadConstantPoolEntry(index);
1368 Node* tenured_raw = __ BytecodeOperandImm(1);
1368 Node* tenured = __ SmiTag(tenured_raw); 1369 Node* tenured = __ SmiTag(tenured_raw);
1369 Node* result = 1370 Node* result =
1370 __ CallRuntime(Runtime::kInterpreterNewClosure, shared, tenured); 1371 __ CallRuntime(Runtime::kInterpreterNewClosure, shared, tenured);
1371 __ SetAccumulator(result); 1372 __ SetAccumulator(result);
1372 __ Dispatch(); 1373 __ Dispatch();
1373 } 1374 }
1374 1375
1375 1376
1377 // CreateClosureWide <index> <tenured>
1378 //
1379 // Creates a new closure for SharedFunctionInfo at position |index| in the
1380 // constant pool and with the PretenureFlag <tenured>.
1381 void Interpreter::DoCreateClosureWide(
1382 compiler::InterpreterAssembler* assembler) {
1383 return DoCreateClosure(assembler);
1384 }
1385
1386
1376 // CreateMappedArguments 1387 // CreateMappedArguments
1377 // 1388 //
1378 // Creates a new mapped arguments object. 1389 // Creates a new mapped arguments object.
1379 void Interpreter::DoCreateMappedArguments( 1390 void Interpreter::DoCreateMappedArguments(
1380 compiler::InterpreterAssembler* assembler) { 1391 compiler::InterpreterAssembler* assembler) {
1381 Node* closure = __ LoadRegister(Register::function_closure()); 1392 Node* closure = __ LoadRegister(Register::function_closure());
1382 Node* result = __ CallRuntime(Runtime::kNewSloppyArguments_Generic, closure); 1393 Node* result = __ CallRuntime(Runtime::kNewSloppyArguments_Generic, closure);
1383 __ SetAccumulator(result); 1394 __ SetAccumulator(result);
1384 __ Dispatch(); 1395 __ Dispatch();
1385 } 1396 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); 1474 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3);
1464 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); 1475 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length);
1465 __ SetAccumulator(result); 1476 __ SetAccumulator(result);
1466 __ Dispatch(); 1477 __ Dispatch();
1467 } 1478 }
1468 1479
1469 1480
1470 } // namespace interpreter 1481 } // namespace interpreter
1471 } // namespace internal 1482 } // namespace internal
1472 } // namespace v8 1483 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | test/cctest/compiler/test-run-bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698