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

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

Issue 1531693002: [Interpreter] Implement ForIn in bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0009-phi
Patch Set: Minor clean-up/simplication in Runtime_InterpreterForInPrepare. 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/compiler/bytecode-graph-builder.cc ('k') | 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"
11 #include "src/identity-map.h" 11 #include "src/identity-map.h"
12 #include "src/interpreter/bytecodes.h" 12 #include "src/interpreter/bytecodes.h"
13 #include "src/zone.h" 13 #include "src/zone.h"
14 #include "src/zone-containers.h" 14 #include "src/zone-containers.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 18
19 class Isolate; 19 class Isolate;
20 20
21 namespace interpreter { 21 namespace interpreter {
22 22
23 class BytecodeLabel; 23 class BytecodeLabel;
24 class Register; 24 class Register;
25 25
26 // TODO(rmcilroy): Unify this with CreateArgumentsParameters::Type in Turbofan 26 // TODO(rmcilroy): Unify this with CreateArgumentsParameters::Type in Turbofan
27 // when rest parameters implementation has settled down. 27 // when rest parameters implementation has settled down.
28 enum class CreateArgumentsType { kMappedArguments, kUnmappedArguments }; 28 enum class CreateArgumentsType { kMappedArguments, kUnmappedArguments };
29 29
30 class BytecodeArrayBuilder { 30 class BytecodeArrayBuilder final {
31 public: 31 public:
32 BytecodeArrayBuilder(Isolate* isolate, Zone* zone); 32 BytecodeArrayBuilder(Isolate* isolate, Zone* zone);
33 ~BytecodeArrayBuilder();
34
33 Handle<BytecodeArray> ToBytecodeArray(); 35 Handle<BytecodeArray> ToBytecodeArray();
34 36
35 // Set the number of parameters expected by function. 37 // Set the number of parameters expected by function.
36 void set_parameter_count(int number_of_params); 38 void set_parameter_count(int number_of_params);
37 int parameter_count() const { 39 int parameter_count() const {
38 DCHECK_GE(parameter_count_, 0); 40 DCHECK_GE(parameter_count_, 0);
39 return parameter_count_; 41 return parameter_count_;
40 } 42 }
41 43
42 // Set the number of locals required for bytecode array. 44 // Set the number of locals required for bytecode array.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 BytecodeArrayBuilder& Jump(BytecodeLabel* label); 206 BytecodeArrayBuilder& Jump(BytecodeLabel* label);
205 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); 207 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label);
206 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); 208 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label);
207 BytecodeArrayBuilder& JumpIfNull(BytecodeLabel* label); 209 BytecodeArrayBuilder& JumpIfNull(BytecodeLabel* label);
208 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); 210 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label);
209 211
210 BytecodeArrayBuilder& Throw(); 212 BytecodeArrayBuilder& Throw();
211 BytecodeArrayBuilder& Return(); 213 BytecodeArrayBuilder& Return();
212 214
213 // Complex flow control. 215 // Complex flow control.
214 BytecodeArrayBuilder& ForInPrepare(Register receiver); 216 BytecodeArrayBuilder& ForInPrepare(Register cache_type, Register cache_array,
215 BytecodeArrayBuilder& ForInNext(Register for_in_state, Register index); 217 Register cache_length);
216 BytecodeArrayBuilder& ForInDone(Register for_in_state); 218 BytecodeArrayBuilder& ForInDone(Register index, Register cache_length);
219 BytecodeArrayBuilder& ForInNext(Register receiver, Register cache_type,
220 Register cache_array, Register index);
221 BytecodeArrayBuilder& ForInStep(Register index);
217 222
218 // Accessors 223 // Accessors
219 Zone* zone() const { return zone_; } 224 Zone* zone() const { return zone_; }
220 225
221 private: 226 private:
222 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } 227 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; }
223 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } 228 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; }
224 Isolate* isolate() const { return isolate_; } 229 Isolate* isolate() const { return isolate_; }
225 230
226 static Bytecode BytecodeForBinaryOperation(Token::Value op); 231 static Bytecode BytecodeForBinaryOperation(Token::Value op);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 Register first_temporary_register() const; 286 Register first_temporary_register() const;
282 Register last_temporary_register() const; 287 Register last_temporary_register() const;
283 288
284 Isolate* isolate_; 289 Isolate* isolate_;
285 Zone* zone_; 290 Zone* zone_;
286 ZoneVector<uint8_t> bytecodes_; 291 ZoneVector<uint8_t> bytecodes_;
287 bool bytecode_generated_; 292 bool bytecode_generated_;
288 size_t last_block_end_; 293 size_t last_block_end_;
289 size_t last_bytecode_start_; 294 size_t last_bytecode_start_;
290 bool exit_seen_in_block_; 295 bool exit_seen_in_block_;
296 int unbound_jumps_;
291 297
292 IdentityMap<size_t> constants_map_; 298 IdentityMap<size_t> constants_map_;
293 ZoneVector<Handle<Object>> constants_; 299 ZoneVector<Handle<Object>> constants_;
294 300
295 int parameter_count_; 301 int parameter_count_;
296 int local_register_count_; 302 int local_register_count_;
297 int context_register_count_; 303 int context_register_count_;
298 int temporary_register_count_; 304 int temporary_register_count_;
299 305
300 ZoneSet<int> free_temporaries_; 306 ZoneSet<int> free_temporaries_;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 379
374 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); 380 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope);
375 }; 381 };
376 382
377 383
378 } // namespace interpreter 384 } // namespace interpreter
379 } // namespace internal 385 } // namespace internal
380 } // namespace v8 386 } // namespace v8
381 387
382 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 388 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698