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

Unified Diff: src/compiler.h

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compilation-cache.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.h
===================================================================
--- src/compiler.h (revision 6800)
+++ src/compiler.h (working copy)
@@ -49,6 +49,7 @@
bool is_lazy() const { return (flags_ & IsLazy::mask()) != 0; }
bool is_eval() const { return (flags_ & IsEval::mask()) != 0; }
bool is_global() const { return (flags_ & IsGlobal::mask()) != 0; }
+ bool is_strict() const { return (flags_ & IsStrict::mask()) != 0; }
bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; }
FunctionLiteral* function() const { return function_; }
Scope* scope() const { return scope_; }
@@ -69,6 +70,12 @@
ASSERT(!is_lazy());
flags_ |= IsGlobal::encode(true);
}
+ void MarkAsStrict() {
+ flags_ |= IsStrict::encode(true);
+ }
+ StrictModeFlag StrictMode() {
+ return is_strict() ? kStrictMode : kNonStrictMode;
+ }
void MarkAsInLoop() {
ASSERT(is_lazy());
flags_ |= IsInLoop::encode(true);
@@ -114,7 +121,7 @@
SetMode(OPTIMIZE);
osr_ast_id_ = osr_ast_id;
}
- void DisableOptimization() { SetMode(NONOPT); }
+ void DisableOptimization();
// Deoptimization support.
bool HasDeoptimizationSupport() const { return supports_deoptimization_; }
@@ -125,9 +132,7 @@
// Determine whether or not we can adaptively optimize.
bool AllowOptimize() {
- return V8::UseCrankshaft() &&
- !closure_.is_null() &&
- function_->AllowOptimize();
+ return V8::UseCrankshaft() && !closure_.is_null();
}
private:
@@ -147,6 +152,9 @@
void Initialize(Mode mode) {
mode_ = V8::UseCrankshaft() ? mode : NONOPT;
+ if (!shared_info_.is_null() && shared_info_->strict_mode()) {
+ MarkAsStrict();
+ }
}
void SetMode(Mode mode) {
@@ -164,6 +172,8 @@
class IsGlobal: public BitField<bool, 2, 1> {};
// Flags that can be set for lazy compilation.
class IsInLoop: public BitField<bool, 3, 1> {};
+ // Strict mode - used in eager compilation.
+ class IsStrict: public BitField<bool, 4, 1> {};
unsigned flags_;
@@ -211,10 +221,14 @@
class Compiler : public AllStatic {
public:
- // All routines return a JSFunction.
- // If an error occurs an exception is raised and
- // the return handle contains NULL.
+ // Default maximum number of function optimization attempts before we
+ // give up.
+ static const int kDefaultMaxOptCount = 10;
+ // All routines return a SharedFunctionInfo.
+ // If an error occurs an exception is raised and the return handle
+ // contains NULL.
+
// Compile a String source within a context.
static Handle<SharedFunctionInfo> Compile(Handle<String> source,
Handle<Object> script_name,
@@ -228,7 +242,8 @@
// Compile a String source within a context for Eval.
static Handle<SharedFunctionInfo> CompileEval(Handle<String> source,
Handle<Context> context,
- bool is_global);
+ bool is_global,
+ StrictModeFlag strict_mode);
// Compile from function info (used for lazy compilation). Returns true on
// success and false if the compilation resulted in a stack overflow.
« 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