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

Side by Side Diff: src/interpreter/bytecode-array-builder.h

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 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 | « no previous file | src/interpreter/bytecode-array-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 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void EnsureReturn(); 257 void EnsureReturn();
258 258
259 bool OperandIsValid(Bytecode bytecode, int operand_index, 259 bool OperandIsValid(Bytecode bytecode, int operand_index,
260 uint32_t operand_value) const; 260 uint32_t operand_value) const;
261 bool LastBytecodeInSameBlock() const; 261 bool LastBytecodeInSameBlock() const;
262 262
263 bool NeedToBooleanCast(); 263 bool NeedToBooleanCast();
264 bool IsRegisterInAccumulator(Register reg); 264 bool IsRegisterInAccumulator(Register reg);
265 265
266 int BorrowTemporaryRegister(); 266 int BorrowTemporaryRegister();
267 int BorrowTemporaryRegisterNotInRange(int start_index, int end_index);
268 int AllocateAndBorrowTemporaryRegister();
267 void ReturnTemporaryRegister(int reg_index); 269 void ReturnTemporaryRegister(int reg_index);
268 int PrepareForConsecutiveTemporaryRegisters(size_t count); 270 int PrepareForConsecutiveTemporaryRegisters(size_t count);
269 void BorrowConsecutiveTemporaryRegister(int reg_index); 271 void BorrowConsecutiveTemporaryRegister(int reg_index);
270 bool TemporaryRegisterIsLive(Register reg) const; 272 bool TemporaryRegisterIsLive(Register reg) const;
271 273
272 Register first_temporary_register() const; 274 Register first_temporary_register() const;
273 Register last_temporary_register() const; 275 Register last_temporary_register() const;
274 276
275 Isolate* isolate_; 277 Isolate* isolate_;
276 Zone* zone_; 278 Zone* zone_;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 341
340 // A stack-allocated class than allows the instantiator to allocate 342 // A stack-allocated class than allows the instantiator to allocate
341 // temporary registers that are cleaned up when scope is closed. 343 // temporary registers that are cleaned up when scope is closed.
342 // TODO(oth): Deprecate TemporaryRegisterScope use. Code should be 344 // TODO(oth): Deprecate TemporaryRegisterScope use. Code should be
343 // using result scopes as far as possible. 345 // using result scopes as far as possible.
344 class TemporaryRegisterScope { 346 class TemporaryRegisterScope {
345 public: 347 public:
346 explicit TemporaryRegisterScope(BytecodeArrayBuilder* builder); 348 explicit TemporaryRegisterScope(BytecodeArrayBuilder* builder);
347 ~TemporaryRegisterScope(); 349 ~TemporaryRegisterScope();
348 Register NewRegister(); 350 Register NewRegister();
351 Register AllocateNewRegister();
349 352
350 void PrepareForConsecutiveAllocations(size_t count); 353 void PrepareForConsecutiveAllocations(size_t count);
351 Register NextConsecutiveRegister(); 354 Register NextConsecutiveRegister();
352 355
353 bool RegisterIsAllocatedInThisScope(Register reg) const; 356 bool RegisterIsAllocatedInThisScope(Register reg) const;
354 357
358 bool hasConsecutiveAllocations() const { return next_consecutive_count_ > 0; }
359
355 private: 360 private:
356 void* operator new(size_t size); 361 void* operator new(size_t size);
357 void operator delete(void* p); 362 void operator delete(void* p);
358 363
359 BytecodeArrayBuilder* builder_; 364 BytecodeArrayBuilder* builder_;
360 const TemporaryRegisterScope* outer_; 365 const TemporaryRegisterScope* outer_;
361 ZoneVector<int> allocated_; 366 ZoneVector<int> allocated_;
362 int next_consecutive_register_; 367 int next_consecutive_register_;
363 int next_consecutive_count_; 368 int next_consecutive_count_;
364 369
365 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); 370 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope);
366 }; 371 };
367 372
368 373
369 } // namespace interpreter 374 } // namespace interpreter
370 } // namespace internal 375 } // namespace internal
371 } // namespace v8 376 } // namespace v8
372 377
373 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 378 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698