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 1475823003: [runtime] First step to sanitize regexp literal creation. (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
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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 // Creates a regular expression literal for literal index <idx> with flags held 1316 // Creates a regular expression literal for literal index <idx> with flags held
1317 // in <flags_reg> and the pattern in the accumulator. 1317 // in <flags_reg> and the pattern in the accumulator.
1318 void Interpreter::DoCreateRegExpLiteral( 1318 void Interpreter::DoCreateRegExpLiteral(
1319 compiler::InterpreterAssembler* assembler) { 1319 compiler::InterpreterAssembler* assembler) {
1320 Node* pattern = __ GetAccumulator(); 1320 Node* pattern = __ GetAccumulator();
1321 Node* literal_index_raw = __ BytecodeOperandIdx(0); 1321 Node* literal_index_raw = __ BytecodeOperandIdx(0);
1322 Node* literal_index = __ SmiTag(literal_index_raw); 1322 Node* literal_index = __ SmiTag(literal_index_raw);
1323 Node* flags_reg = __ BytecodeOperandReg(1); 1323 Node* flags_reg = __ BytecodeOperandReg(1);
1324 Node* flags = __ LoadRegister(flags_reg); 1324 Node* flags = __ LoadRegister(flags_reg);
1325 Node* closure = __ LoadRegister(Register::function_closure()); 1325 Node* closure = __ LoadRegister(Register::function_closure());
1326 Node* literals_array = 1326 Node* result = __ CallRuntime(Runtime::kCreateRegExpLiteral, closure,
1327 __ LoadObjectField(closure, JSFunction::kLiteralsOffset); 1327 literal_index, pattern, flags);
1328 Node* result = __ CallRuntime(Runtime::kMaterializeRegExpLiteral,
1329 literals_array, literal_index, pattern, flags);
1330 __ SetAccumulator(result); 1328 __ SetAccumulator(result);
1331 __ Dispatch(); 1329 __ Dispatch();
1332 } 1330 }
1333 1331
1334 1332
1335 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, 1333 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id,
1336 compiler::InterpreterAssembler* assembler) { 1334 compiler::InterpreterAssembler* assembler) {
1337 Node* constant_elements = __ GetAccumulator(); 1335 Node* constant_elements = __ GetAccumulator();
1338 Node* literal_index_raw = __ BytecodeOperandIdx(0); 1336 Node* literal_index_raw = __ BytecodeOperandIdx(0);
1339 Node* literal_index = __ SmiTag(literal_index_raw); 1337 Node* literal_index = __ SmiTag(literal_index_raw);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); 1472 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3);
1475 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); 1473 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length);
1476 __ SetAccumulator(result); 1474 __ SetAccumulator(result);
1477 __ Dispatch(); 1475 __ Dispatch();
1478 } 1476 }
1479 1477
1480 1478
1481 } // namespace interpreter 1479 } // namespace interpreter
1482 } // namespace internal 1480 } // namespace internal
1483 } // namespace v8 1481 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698