OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_FULL_CODEGEN_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 NestedStatement* Exit(int* context_length) override { | 195 NestedStatement* Exit(int* context_length) override { |
196 auto block_scope = statement()->AsBlock()->scope(); | 196 auto block_scope = statement()->AsBlock()->scope(); |
197 if (block_scope != nullptr) { | 197 if (block_scope != nullptr) { |
198 if (block_scope->ContextLocalCount() > 0) ++(*context_length); | 198 if (block_scope->ContextLocalCount() > 0) ++(*context_length); |
199 } | 199 } |
200 return previous_; | 200 return previous_; |
201 } | 201 } |
202 }; | 202 }; |
203 | 203 |
204 // A class literal expression | |
205 class NestedClassLiteral : public NestedStatement { | |
206 public: | |
207 NestedClassLiteral(FullCodeGenerator* codegen, ClassLiteral* lit) | |
208 : NestedStatement(codegen), | |
209 needs_context_(lit->scope() != nullptr && | |
210 lit->scope()->NeedsContext()) {} | |
211 | |
212 NestedStatement* Exit(int* context_length) override { | |
213 if (needs_context_) ++(*context_length); | |
214 return previous_; | |
215 } | |
216 | |
217 private: | |
218 const bool needs_context_; | |
219 }; | |
220 | |
221 class DeferredCommands { | 204 class DeferredCommands { |
222 public: | 205 public: |
223 enum Command { kReturn, kThrow, kBreak, kContinue }; | 206 enum Command { kReturn, kThrow, kBreak, kContinue }; |
224 typedef int TokenId; | 207 typedef int TokenId; |
225 struct DeferredCommand { | 208 struct DeferredCommand { |
226 Command command; | 209 Command command; |
227 TokenId token; | 210 TokenId token; |
228 Statement* target; | 211 Statement* target; |
229 }; | 212 }; |
230 | 213 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 void EmitNamedSuperPropertyLoad(Property* expr); | 559 void EmitNamedSuperPropertyLoad(Property* expr); |
577 | 560 |
578 // Load a value from super[keyed] property. | 561 // Load a value from super[keyed] property. |
579 // Expect receiver ('this' value), home_object and key on the stack. | 562 // Expect receiver ('this' value), home_object and key on the stack. |
580 void EmitKeyedSuperPropertyLoad(Property* expr); | 563 void EmitKeyedSuperPropertyLoad(Property* expr); |
581 | 564 |
582 // Load a value from a keyed property. | 565 // Load a value from a keyed property. |
583 // The receiver and the key is left on the stack by the IC. | 566 // The receiver and the key is left on the stack by the IC. |
584 void EmitKeyedPropertyLoad(Property* expr); | 567 void EmitKeyedPropertyLoad(Property* expr); |
585 | 568 |
586 // Adds the properties to the class (function) object and to its prototype. | |
587 // Expects the class (function) in the accumulator. The class (function) is | |
588 // in the accumulator after installing all the properties. | |
589 void EmitClassDefineProperties(ClassLiteral* lit); | |
590 | |
591 // Pushes the property key as a Name on the stack. | 569 // Pushes the property key as a Name on the stack. |
592 void EmitPropertyKey(ObjectLiteralProperty* property, BailoutId bailout_id); | 570 void EmitPropertyKey(ObjectLiteralProperty* property, BailoutId bailout_id); |
593 | 571 |
594 // Apply the compound assignment operator. Expects the left operand on top | 572 // Apply the compound assignment operator. Expects the left operand on top |
595 // of the stack and the right one in the accumulator. | 573 // of the stack and the right one in the accumulator. |
596 void EmitBinaryOp(BinaryOperation* expr, Token::Value op); | 574 void EmitBinaryOp(BinaryOperation* expr, Token::Value op); |
597 | 575 |
598 // Helper functions for generating inlined smi code for certain | 576 // Helper functions for generating inlined smi code for certain |
599 // binary operations. | 577 // binary operations. |
600 void EmitInlineSmiBinaryOp(BinaryOperation* expr, | 578 void EmitInlineSmiBinaryOp(BinaryOperation* expr, |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 Address start_; | 1032 Address start_; |
1055 Address instruction_start_; | 1033 Address instruction_start_; |
1056 uint32_t length_; | 1034 uint32_t length_; |
1057 }; | 1035 }; |
1058 | 1036 |
1059 | 1037 |
1060 } // namespace internal | 1038 } // namespace internal |
1061 } // namespace v8 | 1039 } // namespace v8 |
1062 | 1040 |
1063 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1041 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
OLD | NEW |