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

Side by Side Diff: src/full-codegen.h

Issue 981203003: Stack allocate lexical locals + hoist stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Feedback + rebased Created 5 years, 8 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
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/full-codegen.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 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_H_ 5 #ifndef V8_FULL_CODEGEN_H_
6 #define V8_FULL_CODEGEN_H_ 6 #define V8_FULL_CODEGEN_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
11 #include "src/assert-scope.h" 11 #include "src/assert-scope.h"
12 #include "src/ast.h" 12 #include "src/ast.h"
13 #include "src/bit-vector.h" 13 #include "src/bit-vector.h"
14 #include "src/code-stubs.h" 14 #include "src/code-stubs.h"
15 #include "src/codegen.h" 15 #include "src/codegen.h"
16 #include "src/compiler.h" 16 #include "src/compiler.h"
17 #include "src/globals.h" 17 #include "src/globals.h"
18 #include "src/objects.h" 18 #include "src/objects.h"
19 #include "src/scopes.h"
19 20
20 namespace v8 { 21 namespace v8 {
21 namespace internal { 22 namespace internal {
22 23
23 // Forward declarations. 24 // Forward declarations.
24 class JumpPatchSite; 25 class JumpPatchSite;
25 26
26 // AST node visitor which can tell whether a given statement will be breakable 27 // AST node visitor which can tell whether a given statement will be breakable
27 // when the code is compiled by the full compiler in the debugger. This means 28 // when the code is compiled by the full compiler in the debugger. This means
28 // that there will be an IC (load/store/call) in the code generated for the 29 // that there will be an IC (load/store/call) in the code generated for the
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 214
214 // A nested block statement. 215 // A nested block statement.
215 class NestedBlock : public Breakable { 216 class NestedBlock : public Breakable {
216 public: 217 public:
217 NestedBlock(FullCodeGenerator* codegen, Block* block) 218 NestedBlock(FullCodeGenerator* codegen, Block* block)
218 : Breakable(codegen, block) { 219 : Breakable(codegen, block) {
219 } 220 }
220 virtual ~NestedBlock() {} 221 virtual ~NestedBlock() {}
221 222
222 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { 223 virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
223 if (statement()->AsBlock()->scope() != NULL) { 224 auto block_scope = statement()->AsBlock()->scope();
224 ++(*context_length); 225 if (block_scope != nullptr) {
226 if (block_scope->ContextLocalCount() > 0) ++(*context_length);
225 } 227 }
226 return previous_; 228 return previous_;
227 } 229 }
228 }; 230 };
229 231
230 // The try block of a try/catch statement. 232 // The try block of a try/catch statement.
231 class TryCatch : public NestedStatement { 233 class TryCatch : public NestedStatement {
232 public: 234 public:
233 static const int kElementCount = TryBlockConstant::kElementCount; 235 static const int kElementCount = TryBlockConstant::kElementCount;
234 236
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 public: 963 public:
962 EnterBlockScopeIfNeeded(FullCodeGenerator* codegen, Scope* scope, 964 EnterBlockScopeIfNeeded(FullCodeGenerator* codegen, Scope* scope,
963 BailoutId entry_id, BailoutId declarations_id, 965 BailoutId entry_id, BailoutId declarations_id,
964 BailoutId exit_id); 966 BailoutId exit_id);
965 ~EnterBlockScopeIfNeeded(); 967 ~EnterBlockScopeIfNeeded();
966 968
967 private: 969 private:
968 MacroAssembler* masm() const { return codegen_->masm(); } 970 MacroAssembler* masm() const { return codegen_->masm(); }
969 971
970 FullCodeGenerator* codegen_; 972 FullCodeGenerator* codegen_;
971 Scope* scope_;
972 Scope* saved_scope_; 973 Scope* saved_scope_;
973 BailoutId exit_id_; 974 BailoutId exit_id_;
975 bool needs_block_context_;
974 }; 976 };
975 977
976 MacroAssembler* masm_; 978 MacroAssembler* masm_;
977 CompilationInfo* info_; 979 CompilationInfo* info_;
978 Scope* scope_; 980 Scope* scope_;
979 Label return_label_; 981 Label return_label_;
980 NestedStatement* nesting_stack_; 982 NestedStatement* nesting_stack_;
981 int loop_depth_; 983 int loop_depth_;
982 ZoneList<Handle<Object> >* globals_; 984 ZoneList<Handle<Object> >* globals_;
983 Handle<FixedArray> modules_; 985 Handle<FixedArray> modules_;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1100
1099 Address start_; 1101 Address start_;
1100 Address instruction_start_; 1102 Address instruction_start_;
1101 uint32_t length_; 1103 uint32_t length_;
1102 }; 1104 };
1103 1105
1104 1106
1105 } } // namespace v8::internal 1107 } } // namespace v8::internal
1106 1108
1107 #endif // V8_FULL_CODEGEN_H_ 1109 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698