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

Side by Side Diff: src/compiler.h

Issue 898983002: Add strong mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code review + fixes Created 5 years, 10 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/code-stubs.h ('k') | 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/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // is constructed based on the resources available at compile-time. 66 // is constructed based on the resources available at compile-time.
67 class CompilationInfo { 67 class CompilationInfo {
68 public: 68 public:
69 // Various configuration flags for a compilation, as well as some properties 69 // Various configuration flags for a compilation, as well as some properties
70 // of the compiled code produced by a compilation. 70 // of the compiled code produced by a compilation.
71 enum Flag { 71 enum Flag {
72 kLazy = 1 << 0, 72 kLazy = 1 << 0,
73 kEval = 1 << 1, 73 kEval = 1 << 1,
74 kGlobal = 1 << 2, 74 kGlobal = 1 << 2,
75 kStrictMode = 1 << 3, 75 kStrictMode = 1 << 3,
76 kThisHasUses = 1 << 4, 76 kStrongMode = 1 << 4,
77 kNative = 1 << 5, 77 kThisHasUses = 1 << 5,
78 kDeferredCalling = 1 << 6, 78 kNative = 1 << 6,
79 kNonDeferredCalling = 1 << 7, 79 kDeferredCalling = 1 << 7,
80 kSavesCallerDoubles = 1 << 8, 80 kNonDeferredCalling = 1 << 8,
81 kRequiresFrame = 1 << 9, 81 kSavesCallerDoubles = 1 << 9,
82 kMustNotHaveEagerFrame = 1 << 10, 82 kRequiresFrame = 1 << 10,
83 kDeoptimizationSupport = 1 << 11, 83 kMustNotHaveEagerFrame = 1 << 11,
84 kDebug = 1 << 12, 84 kDeoptimizationSupport = 1 << 12,
85 kCompilingForDebugging = 1 << 13, 85 kDebug = 1 << 13,
86 kParseRestriction = 1 << 14, 86 kCompilingForDebugging = 1 << 14,
87 kSerializing = 1 << 15, 87 kParseRestriction = 1 << 15,
88 kContextSpecializing = 1 << 16, 88 kSerializing = 1 << 16,
89 kInliningEnabled = 1 << 17, 89 kContextSpecializing = 1 << 17,
90 kTypingEnabled = 1 << 18, 90 kInliningEnabled = 1 << 18,
91 kDisableFutureOptimization = 1 << 19, 91 kTypingEnabled = 1 << 19,
92 kModule = 1 << 20, 92 kDisableFutureOptimization = 1 << 20,
93 kToplevel = 1 << 21, 93 kModule = 1 << 21,
94 kSplittingEnabled = 1 << 22 94 kToplevel = 1 << 22,
95 kSplittingEnabled = 1 << 23
95 }; 96 };
96 97
97 CompilationInfo(Handle<JSFunction> closure, Zone* zone); 98 CompilationInfo(Handle<JSFunction> closure, Zone* zone);
98 CompilationInfo(Handle<Script> script, Zone* zone); 99 CompilationInfo(Handle<Script> script, Zone* zone);
99 CompilationInfo(Isolate* isolate, Zone* zone); 100 CompilationInfo(Isolate* isolate, Zone* zone);
100 virtual ~CompilationInfo(); 101 virtual ~CompilationInfo();
101 102
102 Isolate* isolate() const { 103 Isolate* isolate() const {
103 return isolate_; 104 return isolate_;
104 } 105 }
105 Zone* zone() { return zone_; } 106 Zone* zone() { return zone_; }
106 bool is_osr() const { return !osr_ast_id_.IsNone(); } 107 bool is_osr() const { return !osr_ast_id_.IsNone(); }
107 bool is_lazy() const { return GetFlag(kLazy); } 108 bool is_lazy() const { return GetFlag(kLazy); }
108 bool is_eval() const { return GetFlag(kEval); } 109 bool is_eval() const { return GetFlag(kEval); }
109 bool is_global() const { return GetFlag(kGlobal); } 110 bool is_global() const { return GetFlag(kGlobal); }
110 bool is_module() const { return GetFlag(kModule); } 111 bool is_module() const { return GetFlag(kModule); }
111 LanguageMode language_mode() const { 112 LanguageMode language_mode() const {
112 STATIC_ASSERT(LANGUAGE_END == 2); 113 STATIC_ASSERT(LANGUAGE_END == 3);
113 return GetFlag(kStrictMode) ? STRICT : SLOPPY; 114 return construct_language_mode(GetFlag(kStrictMode), GetFlag(kStrongMode));
114 } 115 }
115 FunctionLiteral* function() const { return function_; } 116 FunctionLiteral* function() const { return function_; }
116 Scope* scope() const { return scope_; } 117 Scope* scope() const { return scope_; }
117 Scope* script_scope() const { return script_scope_; } 118 Scope* script_scope() const { return script_scope_; }
118 Handle<Code> code() const { return code_; } 119 Handle<Code> code() const { return code_; }
119 Handle<JSFunction> closure() const { return closure_; } 120 Handle<JSFunction> closure() const { return closure_; }
120 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 121 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
121 Handle<Script> script() const { return script_; } 122 Handle<Script> script() const { return script_; }
122 void set_script(Handle<Script> script) { script_ = script; } 123 void set_script(Handle<Script> script) { script_ = script; }
123 HydrogenCodeStub* code_stub() const {return code_stub_; } 124 HydrogenCodeStub* code_stub() const {return code_stub_; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 parameter_count_ = parameter_count; 161 parameter_count_ = parameter_count;
161 } 162 }
162 163
163 void set_this_has_uses(bool has_no_uses) { 164 void set_this_has_uses(bool has_no_uses) {
164 SetFlag(kThisHasUses, has_no_uses); 165 SetFlag(kThisHasUses, has_no_uses);
165 } 166 }
166 167
167 bool this_has_uses() { return GetFlag(kThisHasUses); } 168 bool this_has_uses() { return GetFlag(kThisHasUses); }
168 169
169 void SetLanguageMode(LanguageMode language_mode) { 170 void SetLanguageMode(LanguageMode language_mode) {
170 STATIC_ASSERT(LANGUAGE_END == 2); 171 STATIC_ASSERT(LANGUAGE_END == 3);
171 SetFlag(kStrictMode, language_mode & STRICT); 172 SetFlag(kStrictMode, language_mode & STRICT_BIT);
173 SetFlag(kStrongMode, language_mode & STRONG_BIT);
172 } 174 }
173 175
174 void MarkAsNative() { SetFlag(kNative); } 176 void MarkAsNative() { SetFlag(kNative); }
175 177
176 bool is_native() const { return GetFlag(kNative); } 178 bool is_native() const { return GetFlag(kNative); }
177 179
178 bool is_calling() const { 180 bool is_calling() const {
179 return GetFlag(kDeferredCalling) || GetFlag(kNonDeferredCalling); 181 return GetFlag(kDeferredCalling) || GetFlag(kNonDeferredCalling);
180 } 182 }
181 183
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 Zone zone_; 777 Zone zone_;
776 unsigned info_zone_start_allocation_size_; 778 unsigned info_zone_start_allocation_size_;
777 base::ElapsedTimer timer_; 779 base::ElapsedTimer timer_;
778 780
779 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 781 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
780 }; 782 };
781 783
782 } } // namespace v8::internal 784 } } // namespace v8::internal
783 785
784 #endif // V8_COMPILER_H_ 786 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698