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

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

Issue 2331033002: [interpreter] Merge {OsrPoll} with {Jump} bytecode. (Closed)
Patch Set: One more test. Created 4 years, 3 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
« no previous file with comments | « src/interpreter/control-flow-builders.cc ('k') | src/interpreter/interpreter-assembler.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 <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool 1847 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool
1848 // if the object referenced by the accumulator is the hole constant. 1848 // if the object referenced by the accumulator is the hole constant.
1849 void Interpreter::DoJumpIfNotHoleConstant(InterpreterAssembler* assembler) { 1849 void Interpreter::DoJumpIfNotHoleConstant(InterpreterAssembler* assembler) {
1850 Node* accumulator = __ GetAccumulator(); 1850 Node* accumulator = __ GetAccumulator();
1851 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); 1851 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1852 Node* index = __ BytecodeOperandIdx(0); 1852 Node* index = __ BytecodeOperandIdx(0);
1853 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); 1853 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index);
1854 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); 1854 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump);
1855 } 1855 }
1856 1856
1857 // JumpLoop <imm> <loop_depth>
1858 //
1859 // Jump by number of bytes represented by the immediate operand |imm|. Also
1860 // performs a loop nesting check and potentially triggers OSR in case the
1861 // current OSR level matches (or exceeds) the specified |loop_depth|.
1862 void Interpreter::DoJumpLoop(InterpreterAssembler* assembler) {
1863 Node* relative_jump = __ BytecodeOperandImm(0);
1864 Node* loop_depth = __ BytecodeOperandImm(1);
1865 Node* osr_level = __ LoadOSRNestingLevel();
1866
1867 // Check if OSR points at the given {loop_depth} are armed by comparing it to
1868 // the current {osr_level} loaded from the header of the BytecodeArray.
1869 Label ok(assembler), osr_armed(assembler, Label::kDeferred);
1870 Node* condition = __ Int32GreaterThanOrEqual(loop_depth, osr_level);
1871 __ Branch(condition, &ok, &osr_armed);
1872
1873 __ Bind(&ok);
1874 __ Jump(relative_jump);
1875
1876 __ Bind(&osr_armed);
1877 {
1878 Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_);
1879 Node* target = __ HeapConstant(callable.code());
1880 Node* context = __ GetContext();
1881 __ CallStub(callable.descriptor(), target, context);
1882 __ Jump(relative_jump);
1883 }
1884 }
1885
1857 // CreateRegExpLiteral <pattern_idx> <literal_idx> <flags> 1886 // CreateRegExpLiteral <pattern_idx> <literal_idx> <flags>
1858 // 1887 //
1859 // Creates a regular expression literal for literal index <literal_idx> with 1888 // Creates a regular expression literal for literal index <literal_idx> with
1860 // <flags> and the pattern in <pattern_idx>. 1889 // <flags> and the pattern in <pattern_idx>.
1861 void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) { 1890 void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) {
1862 Node* index = __ BytecodeOperandIdx(0); 1891 Node* index = __ BytecodeOperandIdx(0);
1863 Node* pattern = __ LoadConstantPoolEntry(index); 1892 Node* pattern = __ LoadConstantPoolEntry(index);
1864 Node* literal_index_raw = __ BytecodeOperandIdx(1); 1893 Node* literal_index_raw = __ BytecodeOperandIdx(1);
1865 Node* literal_index = __ SmiTag(literal_index_raw); 1894 Node* literal_index = __ SmiTag(literal_index_raw);
1866 Node* flags_raw = __ BytecodeOperandFlag(2); 1895 Node* flags_raw = __ BytecodeOperandFlag(2);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 __ Dispatch(); 2146 __ Dispatch();
2118 2147
2119 __ Bind(&stack_check_interrupt); 2148 __ Bind(&stack_check_interrupt);
2120 { 2149 {
2121 Node* context = __ GetContext(); 2150 Node* context = __ GetContext();
2122 __ CallRuntime(Runtime::kStackGuard, context); 2151 __ CallRuntime(Runtime::kStackGuard, context);
2123 __ Dispatch(); 2152 __ Dispatch();
2124 } 2153 }
2125 } 2154 }
2126 2155
2127 // OsrPoll <loop_depth>
2128 //
2129 // Performs a loop nesting check and potentially triggers OSR.
2130 void Interpreter::DoOsrPoll(InterpreterAssembler* assembler) {
2131 Node* loop_depth = __ BytecodeOperandImm(0);
2132 Node* osr_level = __ LoadOSRNestingLevel();
2133
2134 // Check if OSR points at the given {loop_depth} are armed by comparing it to
2135 // the current {osr_level} loaded from the header of the BytecodeArray.
2136 Label ok(assembler), osr_armed(assembler, Label::kDeferred);
2137 Node* condition = __ Int32GreaterThanOrEqual(loop_depth, osr_level);
2138 __ Branch(condition, &ok, &osr_armed);
2139
2140 __ Bind(&ok);
2141 __ Dispatch();
2142
2143 __ Bind(&osr_armed);
2144 {
2145 Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_);
2146 Node* target = __ HeapConstant(callable.code());
2147 Node* context = __ GetContext();
2148 __ CallStub(callable.descriptor(), target, context);
2149 __ Dispatch();
2150 }
2151 }
2152
2153 // Throw 2156 // Throw
2154 // 2157 //
2155 // Throws the exception in the accumulator. 2158 // Throws the exception in the accumulator.
2156 void Interpreter::DoThrow(InterpreterAssembler* assembler) { 2159 void Interpreter::DoThrow(InterpreterAssembler* assembler) {
2157 Node* exception = __ GetAccumulator(); 2160 Node* exception = __ GetAccumulator();
2158 Node* context = __ GetContext(); 2161 Node* context = __ GetContext();
2159 __ CallRuntime(Runtime::kThrow, context, exception); 2162 __ CallRuntime(Runtime::kThrow, context, exception);
2160 // We shouldn't ever return from a throw. 2163 // We shouldn't ever return from a throw.
2161 __ Abort(kUnexpectedReturnFromThrow); 2164 __ Abort(kUnexpectedReturnFromThrow);
2162 } 2165 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2466 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2464 __ SmiTag(new_state)); 2467 __ SmiTag(new_state));
2465 __ SetAccumulator(old_state); 2468 __ SetAccumulator(old_state);
2466 2469
2467 __ Dispatch(); 2470 __ Dispatch();
2468 } 2471 }
2469 2472
2470 } // namespace interpreter 2473 } // namespace interpreter
2471 } // namespace internal 2474 } // namespace internal
2472 } // namespace v8 2475 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/control-flow-builders.cc ('k') | src/interpreter/interpreter-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698