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

Side by Side Diff: src/compiler.h

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) 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/compilation-cache.cc ('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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 Isolate* isolate() const { 102 Isolate* isolate() const {
103 return isolate_; 103 return isolate_;
104 } 104 }
105 Zone* zone() { return zone_; } 105 Zone* zone() { return zone_; }
106 bool is_osr() const { return !osr_ast_id_.IsNone(); } 106 bool is_osr() const { return !osr_ast_id_.IsNone(); }
107 bool is_lazy() const { return GetFlag(kLazy); } 107 bool is_lazy() const { return GetFlag(kLazy); }
108 bool is_eval() const { return GetFlag(kEval); } 108 bool is_eval() const { return GetFlag(kEval); }
109 bool is_global() const { return GetFlag(kGlobal); } 109 bool is_global() const { return GetFlag(kGlobal); }
110 bool is_module() const { return GetFlag(kModule); } 110 bool is_module() const { return GetFlag(kModule); }
111 StrictMode strict_mode() const { 111 LanguageMode language_mode() const {
112 STATIC_ASSERT(LANGUAGE_END == 2);
112 return GetFlag(kStrictMode) ? STRICT : SLOPPY; 113 return GetFlag(kStrictMode) ? STRICT : SLOPPY;
113 } 114 }
114 FunctionLiteral* function() const { return function_; } 115 FunctionLiteral* function() const { return function_; }
115 Scope* scope() const { return scope_; } 116 Scope* scope() const { return scope_; }
116 Scope* script_scope() const { return script_scope_; } 117 Scope* script_scope() const { return script_scope_; }
117 Handle<Code> code() const { return code_; } 118 Handle<Code> code() const { return code_; }
118 Handle<JSFunction> closure() const { return closure_; } 119 Handle<JSFunction> closure() const { return closure_; }
119 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 120 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
120 Handle<Script> script() const { return script_; } 121 Handle<Script> script() const { return script_; }
121 void set_script(Handle<Script> script) { script_ = script; } 122 void set_script(Handle<Script> script) { script_ = script; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DCHECK(IsStub()); 159 DCHECK(IsStub());
159 parameter_count_ = parameter_count; 160 parameter_count_ = parameter_count;
160 } 161 }
161 162
162 void set_this_has_uses(bool has_no_uses) { 163 void set_this_has_uses(bool has_no_uses) {
163 SetFlag(kThisHasUses, has_no_uses); 164 SetFlag(kThisHasUses, has_no_uses);
164 } 165 }
165 166
166 bool this_has_uses() { return GetFlag(kThisHasUses); } 167 bool this_has_uses() { return GetFlag(kThisHasUses); }
167 168
168 void SetStrictMode(StrictMode strict_mode) { 169 void SetLanguageMode(LanguageMode language_mode) {
169 SetFlag(kStrictMode, strict_mode == STRICT); 170 STATIC_ASSERT(LANGUAGE_END == 2);
171 SetFlag(kStrictMode, language_mode & STRICT);
170 } 172 }
171 173
172 void MarkAsNative() { SetFlag(kNative); } 174 void MarkAsNative() { SetFlag(kNative); }
173 175
174 bool is_native() const { return GetFlag(kNative); } 176 bool is_native() const { return GetFlag(kNative); }
175 177
176 bool is_calling() const { 178 bool is_calling() const {
177 return GetFlag(kDeferredCalling) || GetFlag(kNonDeferredCalling); 179 return GetFlag(kDeferredCalling) || GetFlag(kNonDeferredCalling);
178 } 180 }
179 181
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 static bool EnsureDeoptimizationSupport(CompilationInfo* info); 710 static bool EnsureDeoptimizationSupport(CompilationInfo* info);
709 711
710 static bool EnsureCompiled(Handle<JSFunction> function, 712 static bool EnsureCompiled(Handle<JSFunction> function,
711 ClearExceptionFlag flag); 713 ClearExceptionFlag flag);
712 714
713 static void CompileForLiveEdit(Handle<Script> script); 715 static void CompileForLiveEdit(Handle<Script> script);
714 716
715 // Compile a String source within a context for eval. 717 // Compile a String source within a context for eval.
716 MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval( 718 MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval(
717 Handle<String> source, Handle<SharedFunctionInfo> outer_info, 719 Handle<String> source, Handle<SharedFunctionInfo> outer_info,
718 Handle<Context> context, StrictMode strict_mode, 720 Handle<Context> context, LanguageMode language_mode,
719 ParseRestriction restriction, int scope_position); 721 ParseRestriction restriction, int scope_position);
720 722
721 // Compile a String source within a context. 723 // Compile a String source within a context.
722 static Handle<SharedFunctionInfo> CompileScript( 724 static Handle<SharedFunctionInfo> CompileScript(
723 Handle<String> source, Handle<Object> script_name, int line_offset, 725 Handle<String> source, Handle<Object> script_name, int line_offset,
724 int column_offset, bool is_debugger_script, bool is_shared_cross_origin, 726 int column_offset, bool is_debugger_script, bool is_shared_cross_origin,
725 Handle<Context> context, v8::Extension* extension, 727 Handle<Context> context, v8::Extension* extension,
726 ScriptData** cached_data, ScriptCompiler::CompileOptions compile_options, 728 ScriptData** cached_data, ScriptCompiler::CompileOptions compile_options,
727 NativesFlag is_natives_code); 729 NativesFlag is_natives_code);
728 730
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 Zone zone_; 775 Zone zone_;
774 unsigned info_zone_start_allocation_size_; 776 unsigned info_zone_start_allocation_size_;
775 base::ElapsedTimer timer_; 777 base::ElapsedTimer timer_;
776 778
777 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 779 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
778 }; 780 };
779 781
780 } } // namespace v8::internal 782 } } // namespace v8::internal
781 783
782 #endif // V8_COMPILER_H_ 784 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/compilation-cache.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698