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

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

Issue 1503963002: [Interpreter] Adds wide variant of CreateLiterals. Adds CreateLiterals to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: renamed BuildLiteral to BuildCreateLiteral. 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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 __ HeapConstant(isolate_->factory()->undefined_value()); 1309 __ HeapConstant(isolate_->factory()->undefined_value());
1310 Node* index = __ BytecodeOperandIdx(0); 1310 Node* index = __ BytecodeOperandIdx(0);
1311 Node* constant = __ LoadConstantPoolEntry(index); 1311 Node* constant = __ LoadConstantPoolEntry(index);
1312 Node* relative_jump = __ SmiUntag(constant); 1312 Node* relative_jump = __ SmiUntag(constant);
1313 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); 1313 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump);
1314 } 1314 }
1315 1315
1316 1316
1317 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, 1317 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id,
1318 compiler::InterpreterAssembler* assembler) { 1318 compiler::InterpreterAssembler* assembler) {
1319 Node* constant_elements = __ GetAccumulator(); 1319 Node* index = __ BytecodeOperandIdx(0);
1320 Node* literal_index_raw = __ BytecodeOperandIdx(0); 1320 Node* constant_elements = __ LoadConstantPoolEntry(index);
1321 Node* literal_index_raw = __ BytecodeOperandIdx(1);
1321 Node* literal_index = __ SmiTag(literal_index_raw); 1322 Node* literal_index = __ SmiTag(literal_index_raw);
1322 Node* flags_raw = __ BytecodeOperandImm(1); 1323 Node* flags_raw = __ BytecodeOperandImm(2);
1323 Node* flags = __ SmiTag(flags_raw); 1324 Node* flags = __ SmiTag(flags_raw);
1324 Node* closure = __ LoadRegister(Register::function_closure()); 1325 Node* closure = __ LoadRegister(Register::function_closure());
1325 Node* result = __ CallRuntime(function_id, closure, literal_index, 1326 Node* result = __ CallRuntime(function_id, closure, literal_index,
1326 constant_elements, flags); 1327 constant_elements, flags);
1327 __ SetAccumulator(result); 1328 __ SetAccumulator(result);
1328 __ Dispatch(); 1329 __ Dispatch();
1329 } 1330 }
1330 1331
1331 1332
1332 // CreateRegExpLiteral <idx> <flags> 1333 // CreateRegExpLiteral <pattern_idx> <literal_idx> <flags>
1333 // 1334 //
1334 // Creates a regular expression literal for literal index <idx> with <flags> and 1335 // Creates a regular expression literal for literal index <literal_idx> with
1335 // the pattern in the accumulator. 1336 // <flags> and the pattern in <pattern_idx>.
1336 void Interpreter::DoCreateRegExpLiteral( 1337 void Interpreter::DoCreateRegExpLiteral(
1337 compiler::InterpreterAssembler* assembler) { 1338 compiler::InterpreterAssembler* assembler) {
1338 DoCreateLiteral(Runtime::kCreateRegExpLiteral, assembler); 1339 DoCreateLiteral(Runtime::kCreateRegExpLiteral, assembler);
1339 } 1340 }
1340 1341
1341 1342
1342 // CreateArrayLiteral <idx> <flags> 1343 // CreateRegExpLiteralWide <pattern_idx> <literal_idx> <flags>
1343 // 1344 //
1344 // Creates an array literal for literal index <idx> with flags <flags> and 1345 // Creates a regular expression literal for literal index <literal_idx> with
1345 // constant elements in the accumulator. 1346 // <flags> and the pattern in <pattern_idx>.
1347 void Interpreter::DoCreateRegExpLiteralWide(
1348 compiler::InterpreterAssembler* assembler) {
1349 DoCreateLiteral(Runtime::kCreateRegExpLiteral, assembler);
1350 }
1351
1352
1353 // CreateArrayLiteral <element_idx> <literal_idx> <flags>
1354 //
1355 // Creates an array literal for literal index <literal_idx> with flags <flags>
1356 // and constant elements in <element_idx>.
1346 void Interpreter::DoCreateArrayLiteral( 1357 void Interpreter::DoCreateArrayLiteral(
1347 compiler::InterpreterAssembler* assembler) { 1358 compiler::InterpreterAssembler* assembler) {
1348 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler); 1359 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler);
1349 } 1360 }
1350 1361
1351 1362
1352 // CreateObjectLiteral <idx> <flags> 1363 // CreateArrayLiteralWide <element_idx> <literal_idx> <flags>
1353 // 1364 //
1354 // Creates an object literal for literal index <idx> with flags <flags> and 1365 // Creates an array literal for literal index <literal_idx> with flags <flags>
1355 // constant elements in the accumulator. 1366 // and constant elements in <element_idx>.
1367 void Interpreter::DoCreateArrayLiteralWide(
1368 compiler::InterpreterAssembler* assembler) {
1369 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler);
1370 }
1371
1372
1373 // CreateObjectLiteral <element_idx> <literal_idx> <flags>
1374 //
1375 // Creates an object literal for literal index <literal_idx> with flags <flags>
1376 // and constant elements in <element_idx>.
1356 void Interpreter::DoCreateObjectLiteral( 1377 void Interpreter::DoCreateObjectLiteral(
1357 compiler::InterpreterAssembler* assembler) { 1378 compiler::InterpreterAssembler* assembler) {
1358 DoCreateLiteral(Runtime::kCreateObjectLiteral, assembler); 1379 DoCreateLiteral(Runtime::kCreateObjectLiteral, assembler);
1359 } 1380 }
1360 1381
1361 1382
1383 // CreateObjectLiteralWide <element_idx> <literal_idx> <flags>
1384 //
1385 // Creates an object literal for literal index <literal_idx> with flags <flags>
1386 // and constant elements in <element_idx>.
1387 void Interpreter::DoCreateObjectLiteralWide(
1388 compiler::InterpreterAssembler* assembler) {
1389 DoCreateLiteral(Runtime::kCreateObjectLiteral, assembler);
1390 }
1391
1392
1362 // CreateClosure <index> <tenured> 1393 // CreateClosure <index> <tenured>
1363 // 1394 //
1364 // Creates a new closure for SharedFunctionInfo at position |index| in the 1395 // Creates a new closure for SharedFunctionInfo at position |index| in the
1365 // constant pool and with the PretenureFlag <tenured>. 1396 // constant pool and with the PretenureFlag <tenured>.
1366 void Interpreter::DoCreateClosure(compiler::InterpreterAssembler* assembler) { 1397 void Interpreter::DoCreateClosure(compiler::InterpreterAssembler* assembler) {
1367 // TODO(rmcilroy): Possibly call FastNewClosureStub when possible instead of 1398 // TODO(rmcilroy): Possibly call FastNewClosureStub when possible instead of
1368 // calling into the runtime. 1399 // calling into the runtime.
1369 Node* index = __ BytecodeOperandIdx(0); 1400 Node* index = __ BytecodeOperandIdx(0);
1370 Node* shared = __ LoadConstantPoolEntry(index); 1401 Node* shared = __ LoadConstantPoolEntry(index);
1371 Node* tenured_raw = __ BytecodeOperandImm(1); 1402 Node* tenured_raw = __ BytecodeOperandImm(1);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); 1508 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3);
1478 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); 1509 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length);
1479 __ SetAccumulator(result); 1510 __ SetAccumulator(result);
1480 __ Dispatch(); 1511 __ Dispatch();
1481 } 1512 }
1482 1513
1483 1514
1484 } // namespace interpreter 1515 } // namespace interpreter
1485 } // namespace internal 1516 } // namespace internal
1486 } // namespace v8 1517 } // 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