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

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

Issue 1472323002: [es6] Correct parsing of regular expression literal flags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix oversight in interpreter 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') | src/objects.h » ('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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 Node* accumulator = __ GetAccumulator(); 1304 Node* accumulator = __ GetAccumulator();
1305 Node* undefined_value = 1305 Node* undefined_value =
1306 __ HeapConstant(isolate_->factory()->undefined_value()); 1306 __ HeapConstant(isolate_->factory()->undefined_value());
1307 Node* index = __ BytecodeOperandIdx(0); 1307 Node* index = __ BytecodeOperandIdx(0);
1308 Node* constant = __ LoadConstantPoolEntry(index); 1308 Node* constant = __ LoadConstantPoolEntry(index);
1309 Node* relative_jump = __ SmiUntag(constant); 1309 Node* relative_jump = __ SmiUntag(constant);
1310 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); 1310 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump);
1311 } 1311 }
1312 1312
1313 1313
1314 // CreateRegExpLiteral <idx> <flags_reg>
1315 //
1316 // Creates a regular expression literal for literal index <idx> with flags held
1317 // in <flags_reg> and the pattern in the accumulator.
1318 void Interpreter::DoCreateRegExpLiteral(
1319 compiler::InterpreterAssembler* assembler) {
1320 Node* pattern = __ GetAccumulator();
1321 Node* literal_index_raw = __ BytecodeOperandIdx(0);
1322 Node* literal_index = __ SmiTag(literal_index_raw);
1323 Node* flags_reg = __ BytecodeOperandReg(1);
1324 Node* flags = __ LoadRegister(flags_reg);
1325 Node* closure = __ LoadRegister(Register::function_closure());
1326 Node* result = __ CallRuntime(Runtime::kCreateRegExpLiteral, closure,
1327 literal_index, pattern, flags);
1328 __ SetAccumulator(result);
1329 __ Dispatch();
1330 }
1331
1332
1333 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, 1314 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id,
1334 compiler::InterpreterAssembler* assembler) { 1315 compiler::InterpreterAssembler* assembler) {
1335 Node* constant_elements = __ GetAccumulator(); 1316 Node* constant_elements = __ GetAccumulator();
1336 Node* literal_index_raw = __ BytecodeOperandIdx(0); 1317 Node* literal_index_raw = __ BytecodeOperandIdx(0);
1337 Node* literal_index = __ SmiTag(literal_index_raw); 1318 Node* literal_index = __ SmiTag(literal_index_raw);
1338 Node* flags_raw = __ BytecodeOperandImm(1); 1319 Node* flags_raw = __ BytecodeOperandImm(1);
1339 Node* flags = __ SmiTag(flags_raw); 1320 Node* flags = __ SmiTag(flags_raw);
1340 Node* closure = __ LoadRegister(Register::function_closure()); 1321 Node* closure = __ LoadRegister(Register::function_closure());
1341 Node* result = __ CallRuntime(function_id, closure, literal_index, 1322 Node* result = __ CallRuntime(function_id, closure, literal_index,
1342 constant_elements, flags); 1323 constant_elements, flags);
1343 __ SetAccumulator(result); 1324 __ SetAccumulator(result);
1344 __ Dispatch(); 1325 __ Dispatch();
1345 } 1326 }
1346 1327
1347 1328
1329 // CreateRegExpLiteral <idx> <flags>
1330 //
1331 // Creates a regular expression literal for literal index <idx> with <flags> and
1332 // the pattern in the accumulator.
1333 void Interpreter::DoCreateRegExpLiteral(
1334 compiler::InterpreterAssembler* assembler) {
1335 DoCreateLiteral(Runtime::kCreateRegExpLiteral, assembler);
1336 }
1337
1338
1348 // CreateArrayLiteral <idx> <flags> 1339 // CreateArrayLiteral <idx> <flags>
1349 // 1340 //
1350 // Creates an array literal for literal index <idx> with flags <flags> and 1341 // Creates an array literal for literal index <idx> with flags <flags> and
1351 // constant elements in the accumulator. 1342 // constant elements in the accumulator.
1352 void Interpreter::DoCreateArrayLiteral( 1343 void Interpreter::DoCreateArrayLiteral(
1353 compiler::InterpreterAssembler* assembler) { 1344 compiler::InterpreterAssembler* assembler) {
1354 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler); 1345 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler);
1355 } 1346 }
1356 1347
1357 1348
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); 1463 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3);
1473 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); 1464 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length);
1474 __ SetAccumulator(result); 1465 __ SetAccumulator(result);
1475 __ Dispatch(); 1466 __ Dispatch();
1476 } 1467 }
1477 1468
1478 1469
1479 } // namespace interpreter 1470 } // namespace interpreter
1480 } // namespace internal 1471 } // namespace internal
1481 } // namespace v8 1472 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698