Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
| 10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
| 11 #include "src/interpreter/constant-array-builder.h" | 11 #include "src/interpreter/constant-array-builder.h" |
| 12 #include "src/interpreter/handler-table-builder.h" | 12 #include "src/interpreter/handler-table-builder.h" |
| 13 #include "src/interpreter/register-translator.h" | 13 #include "src/interpreter/register-translator.h" |
| 14 #include "src/interpreter/source-position-table.h" | 14 #include "src/interpreter/source-position-table.h" |
| 15 #include "src/zone-containers.h" | 15 #include "src/zone-containers.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 class Isolate; | 20 class Isolate; |
| 21 | 21 |
| 22 namespace interpreter { | 22 namespace interpreter { |
| 23 | 23 |
| 24 class BytecodeLabel; | 24 class BytecodeLabel; |
| 25 class Register; | 25 class Register; |
| 26 | 26 |
| 27 // TODO(rmcilroy): Unify this with CreateArgumentsParameters::Type in Turbofan | |
| 28 // when rest parameters implementation has settled down. | |
|
rmcilroy
2016/02/08 09:13:18
Thanks for removing this!
| |
| 29 enum class CreateArgumentsType { kMappedArguments, kUnmappedArguments }; | |
| 30 | |
| 31 class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { | 27 class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| 32 public: | 28 public: |
| 33 BytecodeArrayBuilder(Isolate* isolate, Zone* zone, int parameter_count, | 29 BytecodeArrayBuilder(Isolate* isolate, Zone* zone, int parameter_count, |
| 34 int context_count, int locals_count); | 30 int context_count, int locals_count); |
| 35 ~BytecodeArrayBuilder(); | 31 ~BytecodeArrayBuilder(); |
| 36 | 32 |
| 37 Handle<BytecodeArray> ToBytecodeArray(); | 33 Handle<BytecodeArray> ToBytecodeArray(); |
| 38 | 34 |
| 39 // Get the number of parameters expected by function. | 35 // Get the number of parameters expected by function. |
| 40 int parameter_count() const { | 36 int parameter_count() const { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 BytecodeArrayBuilder& StoreLookupSlot(const Handle<String> name, | 141 BytecodeArrayBuilder& StoreLookupSlot(const Handle<String> name, |
| 146 LanguageMode language_mode); | 142 LanguageMode language_mode); |
| 147 | 143 |
| 148 // Create a new closure for the SharedFunctionInfo. | 144 // Create a new closure for the SharedFunctionInfo. |
| 149 BytecodeArrayBuilder& CreateClosure(Handle<SharedFunctionInfo> shared_info, | 145 BytecodeArrayBuilder& CreateClosure(Handle<SharedFunctionInfo> shared_info, |
| 150 PretenureFlag tenured); | 146 PretenureFlag tenured); |
| 151 | 147 |
| 152 // Create a new arguments object in the accumulator. | 148 // Create a new arguments object in the accumulator. |
| 153 BytecodeArrayBuilder& CreateArguments(CreateArgumentsType type); | 149 BytecodeArrayBuilder& CreateArguments(CreateArgumentsType type); |
| 154 | 150 |
| 155 // Create a new rest arguments object starting at |index| in the accumulator. | |
| 156 BytecodeArrayBuilder& CreateRestArguments(int index); | |
| 157 | |
| 158 // Literals creation. Constant elements should be in the accumulator. | 151 // Literals creation. Constant elements should be in the accumulator. |
| 159 BytecodeArrayBuilder& CreateRegExpLiteral(Handle<String> pattern, | 152 BytecodeArrayBuilder& CreateRegExpLiteral(Handle<String> pattern, |
| 160 int literal_index, int flags); | 153 int literal_index, int flags); |
| 161 BytecodeArrayBuilder& CreateArrayLiteral(Handle<FixedArray> constant_elements, | 154 BytecodeArrayBuilder& CreateArrayLiteral(Handle<FixedArray> constant_elements, |
| 162 int literal_index, int flags); | 155 int literal_index, int flags); |
| 163 BytecodeArrayBuilder& CreateObjectLiteral( | 156 BytecodeArrayBuilder& CreateObjectLiteral( |
| 164 Handle<FixedArray> constant_properties, int literal_index, int flags); | 157 Handle<FixedArray> constant_properties, int literal_index, int flags); |
| 165 | 158 |
| 166 // Push the context in accumulator as the new context, and store in register | 159 // Push the context in accumulator as the new context, and store in register |
| 167 // |context|. | 160 // |context|. |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 size_t offset_; | 414 size_t offset_; |
| 422 | 415 |
| 423 friend class BytecodeArrayBuilder; | 416 friend class BytecodeArrayBuilder; |
| 424 }; | 417 }; |
| 425 | 418 |
| 426 } // namespace interpreter | 419 } // namespace interpreter |
| 427 } // namespace internal | 420 } // namespace internal |
| 428 } // namespace v8 | 421 } // namespace v8 |
| 429 | 422 |
| 430 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 423 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |