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

Side by Side Diff: src/compiler.h

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 virtual ~CompilationInfo(); 59 virtual ~CompilationInfo();
60 60
61 Isolate* isolate() const { 61 Isolate* isolate() const {
62 return isolate_; 62 return isolate_;
63 } 63 }
64 Zone* zone() { return zone_; } 64 Zone* zone() { return zone_; }
65 bool is_osr() const { return !osr_ast_id_.IsNone(); } 65 bool is_osr() const { return !osr_ast_id_.IsNone(); }
66 bool is_lazy() const { return IsLazy::decode(flags_); } 66 bool is_lazy() const { return IsLazy::decode(flags_); }
67 bool is_eval() const { return IsEval::decode(flags_); } 67 bool is_eval() const { return IsEval::decode(flags_); }
68 bool is_global() const { return IsGlobal::decode(flags_); } 68 bool is_global() const { return IsGlobal::decode(flags_); }
69 bool is_sloppy_mode() const { return language_mode() == SLOPPY_MODE; } 69 StrictMode strict_mode() const { return StrictModeField::decode(flags_); }
70 bool is_extended_mode() const { return language_mode() == EXTENDED_MODE; }
71 LanguageMode language_mode() const {
72 return LanguageModeField::decode(flags_);
73 }
74 bool is_in_loop() const { return IsInLoop::decode(flags_); } 70 bool is_in_loop() const { return IsInLoop::decode(flags_); }
75 FunctionLiteral* function() const { return function_; } 71 FunctionLiteral* function() const { return function_; }
76 Scope* scope() const { return scope_; } 72 Scope* scope() const { return scope_; }
77 Scope* global_scope() const { return global_scope_; } 73 Scope* global_scope() const { return global_scope_; }
78 Handle<Code> code() const { return code_; } 74 Handle<Code> code() const { return code_; }
79 Handle<JSFunction> closure() const { return closure_; } 75 Handle<JSFunction> closure() const { return closure_; }
80 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 76 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
81 Handle<Script> script() const { return script_; } 77 Handle<Script> script() const { return script_; }
82 HydrogenCodeStub* code_stub() const {return code_stub_; } 78 HydrogenCodeStub* code_stub() const {return code_stub_; }
83 v8::Extension* extension() const { return extension_; } 79 v8::Extension* extension() const { return extension_; }
(...skipping 18 matching lines...) Expand all
102 ASSERT(IsStub()); 98 ASSERT(IsStub());
103 parameter_count_ = parameter_count; 99 parameter_count_ = parameter_count;
104 } 100 }
105 101
106 void set_this_has_uses(bool has_no_uses) { 102 void set_this_has_uses(bool has_no_uses) {
107 this_has_uses_ = has_no_uses; 103 this_has_uses_ = has_no_uses;
108 } 104 }
109 bool this_has_uses() { 105 bool this_has_uses() {
110 return this_has_uses_; 106 return this_has_uses_;
111 } 107 }
112 void SetLanguageMode(LanguageMode language_mode) { 108 void SetStrictMode(StrictMode strict_mode) {
113 ASSERT(this->language_mode() == SLOPPY_MODE || 109 ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode);
114 this->language_mode() == language_mode || 110 flags_ = StrictModeField::update(flags_, strict_mode);
115 language_mode == EXTENDED_MODE);
116 flags_ = LanguageModeField::update(flags_, language_mode);
117 } 111 }
118 void MarkAsInLoop() { 112 void MarkAsInLoop() {
119 ASSERT(is_lazy()); 113 ASSERT(is_lazy());
120 flags_ |= IsInLoop::encode(true); 114 flags_ |= IsInLoop::encode(true);
121 } 115 }
122 void MarkAsNative() { 116 void MarkAsNative() {
123 flags_ |= IsNative::encode(true); 117 flags_ |= IsNative::encode(true);
124 } 118 }
125 119
126 bool is_native() const { 120 bool is_native() const {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // false by default. 347 // false by default.
354 // 348 //
355 // Compilation is either eager or lazy. 349 // Compilation is either eager or lazy.
356 class IsLazy: public BitField<bool, 0, 1> {}; 350 class IsLazy: public BitField<bool, 0, 1> {};
357 // Flags that can be set for eager compilation. 351 // Flags that can be set for eager compilation.
358 class IsEval: public BitField<bool, 1, 1> {}; 352 class IsEval: public BitField<bool, 1, 1> {};
359 class IsGlobal: public BitField<bool, 2, 1> {}; 353 class IsGlobal: public BitField<bool, 2, 1> {};
360 // Flags that can be set for lazy compilation. 354 // Flags that can be set for lazy compilation.
361 class IsInLoop: public BitField<bool, 3, 1> {}; 355 class IsInLoop: public BitField<bool, 3, 1> {};
362 // Strict mode - used in eager compilation. 356 // Strict mode - used in eager compilation.
363 class LanguageModeField: public BitField<LanguageMode, 4, 2> {}; 357 class StrictModeField: public BitField<StrictMode, 4, 1> {};
364 // Is this a function from our natives. 358 // Is this a function from our natives.
365 class IsNative: public BitField<bool, 6, 1> {}; 359 class IsNative: public BitField<bool, 5, 1> {};
366 // Is this code being compiled with support for deoptimization.. 360 // Is this code being compiled with support for deoptimization..
367 class SupportsDeoptimization: public BitField<bool, 7, 1> {}; 361 class SupportsDeoptimization: public BitField<bool, 6, 1> {};
368 // If compiling for debugging produce just full code matching the 362 // If compiling for debugging produce just full code matching the
369 // initial mode setting. 363 // initial mode setting.
370 class IsCompilingForDebugging: public BitField<bool, 8, 1> {}; 364 class IsCompilingForDebugging: public BitField<bool, 7, 1> {};
371 // If the compiled code contains calls that require building a frame 365 // If the compiled code contains calls that require building a frame
372 class IsCalling: public BitField<bool, 9, 1> {}; 366 class IsCalling: public BitField<bool, 8, 1> {};
373 // If the compiled code contains calls that require building a frame 367 // If the compiled code contains calls that require building a frame
374 class IsDeferredCalling: public BitField<bool, 10, 1> {}; 368 class IsDeferredCalling: public BitField<bool, 9, 1> {};
375 // If the compiled code contains calls that require building a frame 369 // If the compiled code contains calls that require building a frame
376 class IsNonDeferredCalling: public BitField<bool, 11, 1> {}; 370 class IsNonDeferredCalling: public BitField<bool, 10, 1> {};
377 // If the compiled code saves double caller registers that it clobbers. 371 // If the compiled code saves double caller registers that it clobbers.
378 class SavesCallerDoubles: public BitField<bool, 12, 1> {}; 372 class SavesCallerDoubles: public BitField<bool, 11, 1> {};
379 // If the set of valid statements is restricted. 373 // If the set of valid statements is restricted.
380 class ParseRestricitonField: public BitField<ParseRestriction, 13, 1> {}; 374 class ParseRestricitonField: public BitField<ParseRestriction, 12, 1> {};
381 // If the function requires a frame (for unspecified reasons) 375 // If the function requires a frame (for unspecified reasons)
382 class RequiresFrame: public BitField<bool, 14, 1> {}; 376 class RequiresFrame: public BitField<bool, 13, 1> {};
383 377
384 unsigned flags_; 378 unsigned flags_;
385 379
386 // Fields filled in by the compilation pipeline. 380 // Fields filled in by the compilation pipeline.
387 // AST filled in by the parser. 381 // AST filled in by the parser.
388 FunctionLiteral* function_; 382 FunctionLiteral* function_;
389 // The scope of the function literal as a convenience. Set to indicate 383 // The scope of the function literal as a convenience. Set to indicate
390 // that scopes have been analyzed. 384 // that scopes have been analyzed.
391 Scope* scope_; 385 Scope* scope_;
392 // The global scope provided as a convenience. 386 // The global scope provided as a convenience.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 ClearExceptionFlag flag); 605 ClearExceptionFlag flag);
612 static Handle<Code> GetCodeForDebugging(Handle<JSFunction> function); 606 static Handle<Code> GetCodeForDebugging(Handle<JSFunction> function);
613 607
614 #ifdef ENABLE_DEBUGGER_SUPPORT 608 #ifdef ENABLE_DEBUGGER_SUPPORT
615 static void CompileForLiveEdit(Handle<Script> script); 609 static void CompileForLiveEdit(Handle<Script> script);
616 #endif 610 #endif
617 611
618 // Compile a String source within a context for eval. 612 // Compile a String source within a context for eval.
619 static Handle<JSFunction> GetFunctionFromEval(Handle<String> source, 613 static Handle<JSFunction> GetFunctionFromEval(Handle<String> source,
620 Handle<Context> context, 614 Handle<Context> context,
621 LanguageMode language_mode, 615 StrictMode strict_mode,
622 ParseRestriction restriction, 616 ParseRestriction restriction,
623 int scope_position); 617 int scope_position);
624 618
625 // Compile a String source within a context. 619 // Compile a String source within a context.
626 static Handle<SharedFunctionInfo> CompileScript(Handle<String> source, 620 static Handle<SharedFunctionInfo> CompileScript(Handle<String> source,
627 Handle<Object> script_name, 621 Handle<Object> script_name,
628 int line_offset, 622 int line_offset,
629 int column_offset, 623 int column_offset,
630 bool is_shared_cross_origin, 624 bool is_shared_cross_origin,
631 Handle<Context> context, 625 Handle<Context> context,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 unsigned info_zone_start_allocation_size_; 673 unsigned info_zone_start_allocation_size_;
680 ElapsedTimer timer_; 674 ElapsedTimer timer_;
681 675
682 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 676 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
683 }; 677 };
684 678
685 679
686 } } // namespace v8::internal 680 } } // namespace v8::internal
687 681
688 #endif // V8_COMPILER_H_ 682 #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