Index: src/compiler.h |
diff --git a/src/compiler.h b/src/compiler.h |
index 62eedc268fdf96843725228b9197a80221b73c23..0c2b12325b9ba8373ed53b5fc7209591f2c48a04 100644 |
--- a/src/compiler.h |
+++ b/src/compiler.h |
@@ -36,6 +36,7 @@ namespace v8 { |
namespace internal { |
class ScriptDataImpl; |
+class HydrogenCodeStub; |
// CompilationInfo encapsulates some information known at compile time. It |
// is constructed based on the resources available at compile-time. |
@@ -44,6 +45,7 @@ class CompilationInfo { |
CompilationInfo(Handle<Script> script, Zone* zone); |
CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); |
CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
+ CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone); |
virtual ~CompilationInfo(); |
@@ -70,10 +72,14 @@ class CompilationInfo { |
Handle<JSFunction> closure() const { return closure_; } |
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
Handle<Script> script() const { return script_; } |
+ HydrogenCodeStub* code_stub() {return code_stub_; } |
v8::Extension* extension() const { return extension_; } |
ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } |
Handle<Context> context() const { return context_; } |
BailoutId osr_ast_id() const { return osr_ast_id_; } |
+ int num_parameters() const; |
+ int num_heap_slots() const; |
+ Code::Flags flags() const; |
void MarkAsEval() { |
ASSERT(!is_lazy()); |
@@ -96,9 +102,31 @@ class CompilationInfo { |
void MarkAsNative() { |
flags_ |= IsNative::encode(true); |
} |
+ |
bool is_native() const { |
return IsNative::decode(flags_); |
} |
+ |
+ bool is_calling() const { |
+ return is_deferred_calling() || is_non_deferred_calling(); |
+ } |
+ |
+ void MarkAsDeferredCalling() { |
+ flags_ |= IsDeferredCalling::encode(true); |
+ } |
+ |
+ bool is_deferred_calling() const { |
+ return IsDeferredCalling::decode(flags_); |
+ } |
+ |
+ void MarkAsNonDeferredCalling() { |
+ flags_ |= IsNonDeferredCalling::encode(true); |
+ } |
+ |
+ bool is_non_deferred_calling() const { |
+ return IsNonDeferredCalling::decode(flags_); |
+ } |
+ |
void SetFunction(FunctionLiteral* literal) { |
ASSERT(function_ == NULL); |
function_ = literal; |
@@ -149,6 +177,7 @@ class CompilationInfo { |
// Accessors for the different compilation modes. |
bool IsOptimizing() const { return mode_ == OPTIMIZE; } |
bool IsOptimizable() const { return mode_ == BASE; } |
+ bool IsStub() const { return mode_ == STUB; } |
void SetOptimizing(BailoutId osr_ast_id) { |
SetMode(OPTIMIZE); |
osr_ast_id_ = osr_ast_id; |
@@ -197,10 +226,15 @@ class CompilationInfo { |
enum Mode { |
BASE, |
OPTIMIZE, |
- NONOPT |
+ NONOPT, |
+ STUB |
}; |
void Initialize(Mode mode) { |
+ if (mode == STUB) { |
+ mode_ = STUB; |
+ return; |
+ } |
mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
ASSERT(!script_.is_null()); |
if (script_->type()->value() == Script::TYPE_NATIVE) { |
@@ -237,6 +271,12 @@ class CompilationInfo { |
// If compiling for debugging produce just full code matching the |
// initial mode setting. |
class IsCompilingForDebugging: public BitField<bool, 8, 1> {}; |
+ // If the compiled code contains calls that require building a frame |
+ class IsCalling: public BitField<bool, 9, 1> {}; |
+ // If the compiled code contains calls that require building a frame |
+ class IsDeferredCalling: public BitField<bool, 10, 1> {}; |
+ // If the compiled code contains calls that require building a frame |
+ class IsNonDeferredCalling: public BitField<bool, 11, 1> {}; |
unsigned flags_; |
@@ -249,6 +289,8 @@ class CompilationInfo { |
Scope* scope_; |
// The global scope provided as a convenience. |
Scope* global_scope_; |
+ // For compiled stubs, the stub object |
+ HydrogenCodeStub* code_stub_; |
// The compiled code. |
Handle<Code> code_; |
@@ -307,6 +349,10 @@ class CompilationInfoWithZone: public CompilationInfo { |
: CompilationInfo(closure, &zone_), |
zone_(closure->GetIsolate()), |
zone_scope_(&zone_, DELETE_ON_EXIT) {} |
+ explicit CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate) |
+ : CompilationInfo(stub, isolate, &zone_), |
+ zone_(isolate), |
+ zone_scope_(&zone_, DELETE_ON_EXIT) {} |
private: |
Zone zone_; |
@@ -332,7 +378,7 @@ class CompilationHandleScope BASE_EMBEDDED { |
class HGraph; |
-class HGraphBuilder; |
+class HOptimizedGraphBuilder; |
class LChunk; |
// A helper class that calls the three compilation phases in |
@@ -374,7 +420,7 @@ class OptimizingCompiler: public ZoneObject { |
private: |
CompilationInfo* info_; |
TypeFeedbackOracle* oracle_; |
- HGraphBuilder* graph_builder_; |
+ HOptimizedGraphBuilder* graph_builder_; |
HGraph* graph_; |
LChunk* chunk_; |
int64_t time_taken_to_create_graph_; |