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

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

Powered by Google App Engine
This is Rietveld 408576698