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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 1531273002: [Interpreter] Allocates new temporary register outside the reservation for consecutive registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing mjsunit.status again. one test is failing on bots. Created 4 years, 12 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
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/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/interpreter/control-flow-builders.h" 9 #include "src/interpreter/control-flow-builders.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 bool IsEffect() const { return kind_ == Expression::kEffect; } 198 bool IsEffect() const { return kind_ == Expression::kEffect; }
199 bool IsValue() const { return kind_ == Expression::kValue; } 199 bool IsValue() const { return kind_ == Expression::kValue; }
200 200
201 virtual void SetResultInAccumulator() = 0; 201 virtual void SetResultInAccumulator() = 0;
202 virtual void SetResultInRegister(Register reg) = 0; 202 virtual void SetResultInRegister(Register reg) = 0;
203 203
204 BytecodeGenerator* generator() const { return generator_; } 204 BytecodeGenerator* generator() const { return generator_; }
205 BytecodeArrayBuilder* builder() const { return generator()->builder(); } 205 BytecodeArrayBuilder* builder() const { return generator()->builder(); }
206 ExpressionResultScope* outer() const { return outer_; } 206 ExpressionResultScope* outer() const { return outer_; }
207 207
208 Register NewRegister() { return allocator_.NewRegister(); } 208 Register NewRegister() {
209 ExpressionResultScope* current_scope = generator()->execution_result();
210 if ((current_scope == this) ||
211 (current_scope->outer() == this &&
212 !current_scope->allocator_.hasConsecutiveAllocations())) {
213 // Regular case - Allocating registers in current or outer context.
214 // VisitForRegisterValue allocates register in outer context.
215 return allocator_.NewRegister();
216 } else {
217 // We need this when allocating registers due to an Assignment hazard.
218 // It might be expensive to walk the full context chain and compute the
219 // list of consecutive reservations in the innerscopes. So allocates a
220 // new unallocated temporary register.
221 return allocator_.AllocateNewRegister();
222 }
223 }
209 224
210 void PrepareForConsecutiveAllocations(size_t count) { 225 void PrepareForConsecutiveAllocations(size_t count) {
211 allocator_.PrepareForConsecutiveAllocations(count); 226 allocator_.PrepareForConsecutiveAllocations(count);
212 } 227 }
213 228
214 Register NextConsecutiveRegister() { 229 Register NextConsecutiveRegister() {
215 return allocator_.NextConsecutiveRegister(); 230 return allocator_.NextConsecutiveRegister();
216 } 231 }
217 232
218 protected: 233 protected:
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 } 2213 }
2199 2214
2200 2215
2201 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2216 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2202 return info()->feedback_vector()->GetIndex(slot); 2217 return info()->feedback_vector()->GetIndex(slot);
2203 } 2218 }
2204 2219
2205 } // namespace interpreter 2220 } // namespace interpreter
2206 } // namespace internal 2221 } // namespace internal
2207 } // namespace v8 2222 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698