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

Side by Side Diff: src/compiler.h

Issue 379563002: Fix issues with code serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler.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_COMPILER_H_ 5 #ifndef V8_COMPILER_H_
6 #define V8_COMPILER_H_ 6 #define V8_COMPILER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 Handle<Code> unoptimized_code() const { return unoptimized_code_; } 69 Handle<Code> unoptimized_code() const { return unoptimized_code_; }
70 int opt_count() const { return opt_count_; } 70 int opt_count() const { return opt_count_; }
71 int num_parameters() const; 71 int num_parameters() const;
72 int num_heap_slots() const; 72 int num_heap_slots() const;
73 Code::Flags flags() const; 73 Code::Flags flags() const;
74 74
75 void MarkAsEval() { 75 void MarkAsEval() {
76 ASSERT(!is_lazy()); 76 ASSERT(!is_lazy());
77 flags_ |= IsEval::encode(true); 77 flags_ |= IsEval::encode(true);
78 } 78 }
79
79 void MarkAsGlobal() { 80 void MarkAsGlobal() {
80 ASSERT(!is_lazy()); 81 ASSERT(!is_lazy());
81 flags_ |= IsGlobal::encode(true); 82 flags_ |= IsGlobal::encode(true);
82 } 83 }
84
83 void set_parameter_count(int parameter_count) { 85 void set_parameter_count(int parameter_count) {
84 ASSERT(IsStub()); 86 ASSERT(IsStub());
85 parameter_count_ = parameter_count; 87 parameter_count_ = parameter_count;
86 } 88 }
87 89
88 void set_this_has_uses(bool has_no_uses) { 90 void set_this_has_uses(bool has_no_uses) {
89 this_has_uses_ = has_no_uses; 91 this_has_uses_ = has_no_uses;
90 } 92 }
93
91 bool this_has_uses() { 94 bool this_has_uses() {
92 return this_has_uses_; 95 return this_has_uses_;
93 } 96 }
97
94 void SetStrictMode(StrictMode strict_mode) { 98 void SetStrictMode(StrictMode strict_mode) {
95 ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode); 99 ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode);
96 flags_ = StrictModeField::update(flags_, strict_mode); 100 flags_ = StrictModeField::update(flags_, strict_mode);
97 } 101 }
102
98 void MarkAsNative() { 103 void MarkAsNative() {
99 flags_ |= IsNative::encode(true); 104 flags_ |= IsNative::encode(true);
100 } 105 }
101 106
102 bool is_native() const { 107 bool is_native() const {
103 return IsNative::decode(flags_); 108 return IsNative::decode(flags_);
104 } 109 }
105 110
106 bool is_calling() const { 111 bool is_calling() const {
107 return is_deferred_calling() || is_non_deferred_calling(); 112 return is_deferred_calling() || is_non_deferred_calling();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 153 }
149 154
150 void MarkAsDebug() { 155 void MarkAsDebug() {
151 flags_ |= IsDebug::encode(true); 156 flags_ |= IsDebug::encode(true);
152 } 157 }
153 158
154 bool is_debug() const { 159 bool is_debug() const {
155 return IsDebug::decode(flags_); 160 return IsDebug::decode(flags_);
156 } 161 }
157 162
163 void PrepareForSerializing() {
164 ASSERT(!is_lazy());
165 flags_ |= PrepareForSerializing::encode(true);
166 }
167
168 bool will_serialize() const { return PrepareForSerializing::decode(flags_); }
169
158 bool IsCodePreAgingActive() const { 170 bool IsCodePreAgingActive() const {
159 return FLAG_optimize_for_size && FLAG_age_code && !is_debug(); 171 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() &&
172 !is_debug();
160 } 173 }
161 174
162 void SetParseRestriction(ParseRestriction restriction) { 175 void SetParseRestriction(ParseRestriction restriction) {
163 flags_ = ParseRestricitonField::update(flags_, restriction); 176 flags_ = ParseRestricitonField::update(flags_, restriction);
164 } 177 }
165 178
166 ParseRestriction parse_restriction() const { 179 ParseRestriction parse_restriction() const {
167 return ParseRestricitonField::decode(flags_); 180 return ParseRestricitonField::decode(flags_);
168 } 181 }
169 182
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // If the compiled code contains calls that require building a frame 399 // If the compiled code contains calls that require building a frame
387 class IsNonDeferredCalling: public BitField<bool, 10, 1> {}; 400 class IsNonDeferredCalling: public BitField<bool, 10, 1> {};
388 // If the compiled code saves double caller registers that it clobbers. 401 // If the compiled code saves double caller registers that it clobbers.
389 class SavesCallerDoubles: public BitField<bool, 11, 1> {}; 402 class SavesCallerDoubles: public BitField<bool, 11, 1> {};
390 // If the set of valid statements is restricted. 403 // If the set of valid statements is restricted.
391 class ParseRestricitonField: public BitField<ParseRestriction, 12, 1> {}; 404 class ParseRestricitonField: public BitField<ParseRestriction, 12, 1> {};
392 // If the function requires a frame (for unspecified reasons) 405 // If the function requires a frame (for unspecified reasons)
393 class RequiresFrame: public BitField<bool, 13, 1> {}; 406 class RequiresFrame: public BitField<bool, 13, 1> {};
394 // If the function cannot build a frame (for unspecified reasons) 407 // If the function cannot build a frame (for unspecified reasons)
395 class MustNotHaveEagerFrame: public BitField<bool, 14, 1> {}; 408 class MustNotHaveEagerFrame: public BitField<bool, 14, 1> {};
409 // If we plan to serialize the compiled code.
410 class PrepareForSerializing : public BitField<bool, 15, 1> {};
396 411
397 unsigned flags_; 412 unsigned flags_;
398 413
399 // Fields filled in by the compilation pipeline. 414 // Fields filled in by the compilation pipeline.
400 // AST filled in by the parser. 415 // AST filled in by the parser.
401 FunctionLiteral* function_; 416 FunctionLiteral* function_;
402 // The scope of the function literal as a convenience. Set to indicate 417 // The scope of the function literal as a convenience. Set to indicate
403 // that scopes have been analyzed. 418 // that scopes have been analyzed.
404 Scope* scope_; 419 Scope* scope_;
405 // The global scope provided as a convenience. 420 // The global scope provided as a convenience.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 unsigned info_zone_start_allocation_size_; 719 unsigned info_zone_start_allocation_size_;
705 base::ElapsedTimer timer_; 720 base::ElapsedTimer timer_;
706 721
707 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 722 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
708 }; 723 };
709 724
710 725
711 } } // namespace v8::internal 726 } } // namespace v8::internal
712 727
713 #endif // V8_COMPILER_H_ 728 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698