summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/v8/src/hydrogen.h
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2012-04-17 11:03:39 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-26 08:55:55 +0200
commit227e72d1bba70d518639996aab4146b060507cd6 (patch)
tree723564e760e94a7d205a3d3300c44192e1d2f2e1 /src/3rdparty/v8/src/hydrogen.h
parent5b1fcb16da41f711f27f2e8ff84de8b70a30b645 (diff)
Updated V8 from git://github.com/v8/v8.git to 57f8959fb264354ba1a2e5118db512f588917061
Update V8 source to version 3.10.1. * Added optimizations and stability improvements on all platforms. * Various performance improvements. * Cleanup ScopeInfo and SerializedScopeInfo. * Introduce extended mode. * Implemented performance improvements to the incremental garbage collector. * Fixed handling of arrays in DefineOwnProperty. (issue 1756) * Fixed GCC 4.7 warnings. * Performance improvements for large Smi-only arrays. * Reduce the space used by the stack for the profiling thread. * Reduced memory use immediately after starting V8. * Fixed VFP detection through compiler defines. (issue 1996) * Remove static initializers in v8. (issue 1859) * Optimized boot-up memory use. * Optimized regular expressions. Change-Id: I2dad3092612de279179950dae4dd43daf0463a9f Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/hydrogen.h')
-rw-r--r--src/3rdparty/v8/src/hydrogen.h177
1 files changed, 151 insertions, 26 deletions
diff --git a/src/3rdparty/v8/src/hydrogen.h b/src/3rdparty/v8/src/hydrogen.h
index 2d08dc8..bc9bc9d 100644
--- a/src/3rdparty/v8/src/hydrogen.h
+++ b/src/3rdparty/v8/src/hydrogen.h
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -126,6 +126,7 @@ class HBasicBlock: public ZoneObject {
int PredecessorIndexOf(HBasicBlock* predecessor) const;
void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); }
void AssignCommonDominator(HBasicBlock* other);
+ void AssignLoopSuccessorDominators();
void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) {
FinishExit(CreateDeoptimize(has_uses));
@@ -149,6 +150,13 @@ class HBasicBlock: public ZoneObject {
bool IsDeoptimizing() const { return is_deoptimizing_; }
void MarkAsDeoptimizing() { is_deoptimizing_ = true; }
+ bool IsLoopSuccessorDominator() const {
+ return dominates_loop_successors_;
+ }
+ void MarkAsLoopSuccessorDominator() {
+ dominates_loop_successors_ = true;
+ }
+
inline Zone* zone();
#ifdef DEBUG
@@ -182,6 +190,22 @@ class HBasicBlock: public ZoneObject {
HBasicBlock* parent_loop_header_;
bool is_inline_return_target_;
bool is_deoptimizing_;
+ bool dominates_loop_successors_;
+};
+
+
+class HPredecessorIterator BASE_EMBEDDED {
+ public:
+ explicit HPredecessorIterator(HBasicBlock* block)
+ : predecessor_list_(block->predecessors()), current_(0) { }
+
+ bool Done() { return current_ >= predecessor_list_->length(); }
+ HBasicBlock* Current() { return predecessor_list_->at(current_); }
+ void Advance() { current_++; }
+
+ private:
+ const ZoneList<HBasicBlock*>* predecessor_list_;
+ int current_;
};
@@ -269,7 +293,6 @@ class HGraph: public ZoneObject {
HArgumentsObject* GetArgumentsObject() const {
return arguments_object_.get();
}
- bool HasArgumentsObject() const { return arguments_object_.is_set(); }
void SetArgumentsObject(HArgumentsObject* object) {
arguments_object_.set(object);
@@ -290,6 +313,26 @@ class HGraph: public ZoneObject {
void Verify(bool do_full_verify) const;
#endif
+ bool has_osr_loop_entry() {
+ return osr_loop_entry_.is_set();
+ }
+
+ HBasicBlock* osr_loop_entry() {
+ return osr_loop_entry_.get();
+ }
+
+ void set_osr_loop_entry(HBasicBlock* entry) {
+ osr_loop_entry_.set(entry);
+ }
+
+ ZoneList<HUnknownOSRValue*>* osr_values() {
+ return osr_values_.get();
+ }
+
+ void set_osr_values(ZoneList<HUnknownOSRValue*>* values) {
+ osr_values_.set(values);
+ }
+
private:
void Postorder(HBasicBlock* block,
BitVector* visited,
@@ -330,6 +373,9 @@ class HGraph: public ZoneObject {
SetOncePointer<HConstant> constant_hole_;
SetOncePointer<HArgumentsObject> arguments_object_;
+ SetOncePointer<HBasicBlock> osr_loop_entry_;
+ SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_;
+
DISALLOW_COPY_AND_ASSIGN(HGraph);
};
@@ -337,18 +383,34 @@ class HGraph: public ZoneObject {
Zone* HBasicBlock::zone() { return graph_->zone(); }
+// Type of stack frame an environment might refer to.
+enum FrameType { JS_FUNCTION, JS_CONSTRUCT, ARGUMENTS_ADAPTOR };
+
+
class HEnvironment: public ZoneObject {
public:
HEnvironment(HEnvironment* outer,
Scope* scope,
Handle<JSFunction> closure);
+ HEnvironment* DiscardInlined(bool drop_extra) {
+ HEnvironment* outer = outer_;
+ while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_;
+ if (drop_extra) outer->Drop(1);
+ return outer;
+ }
+
+ HEnvironment* arguments_environment() {
+ return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this;
+ }
+
// Simple accessors.
Handle<JSFunction> closure() const { return closure_; }
const ZoneList<HValue*>* values() const { return &values_; }
const ZoneList<int>* assigned_variables() const {
return &assigned_variables_;
}
+ FrameType frame_type() const { return frame_type_; }
int parameter_count() const { return parameter_count_; }
int specials_count() const { return specials_count_; }
int local_count() const { return local_count_; }
@@ -364,6 +426,10 @@ class HEnvironment: public ZoneObject {
return i >= parameter_count() && i < parameter_count() + specials_count();
}
+ int first_expression_index() const {
+ return parameter_count() + specials_count() + local_count();
+ }
+
void Bind(Variable* variable, HValue* value) {
Bind(IndexFor(variable), value);
}
@@ -427,9 +493,11 @@ class HEnvironment: public ZoneObject {
// environment is the outer environment but the top expression stack
// elements are moved to an inner environment as parameters.
HEnvironment* CopyForInlining(Handle<JSFunction> target,
+ int arguments,
FunctionLiteral* function,
HConstant* undefined,
- CallKind call_kind) const;
+ CallKind call_kind,
+ bool is_construct) const;
void AddIncomingEdge(HBasicBlock* block, HEnvironment* other);
@@ -450,6 +518,18 @@ class HEnvironment: public ZoneObject {
private:
explicit HEnvironment(const HEnvironment* other);
+ HEnvironment(HEnvironment* outer,
+ Handle<JSFunction> closure,
+ FrameType frame_type,
+ int arguments);
+
+ // Create an artificial stub environment (e.g. for argument adaptor or
+ // constructor stub).
+ HEnvironment* CreateStubEnvironment(HEnvironment* outer,
+ Handle<JSFunction> target,
+ FrameType frame_type,
+ int arguments) const;
+
// True if index is included in the expression stack part of the environment.
bool HasExpressionAt(int index) const;
@@ -471,6 +551,7 @@ class HEnvironment: public ZoneObject {
// Value array [parameters] [specials] [locals] [temporaries].
ZoneList<HValue*> values_;
ZoneList<int> assigned_variables_;
+ FrameType frame_type_;
int parameter_count_;
int specials_count_;
int local_count_;
@@ -605,18 +686,26 @@ class TestContext: public AstContext {
};
+enum ReturnHandlingFlag {
+ NORMAL_RETURN,
+ DROP_EXTRA_ON_RETURN,
+ CONSTRUCT_CALL_RETURN
+};
+
+
class FunctionState {
public:
FunctionState(HGraphBuilder* owner,
CompilationInfo* info,
TypeFeedbackOracle* oracle,
- bool drop_extra);
+ ReturnHandlingFlag return_handling);
~FunctionState();
CompilationInfo* compilation_info() { return compilation_info_; }
TypeFeedbackOracle* oracle() { return oracle_; }
AstContext* call_context() { return call_context_; }
- bool drop_extra() { return drop_extra_; }
+ bool drop_extra() { return return_handling_ == DROP_EXTRA_ON_RETURN; }
+ bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; }
HBasicBlock* function_return() { return function_return_; }
TestContext* test_context() { return test_context_; }
void ClearInlinedTestContext() {
@@ -636,11 +725,13 @@ class FunctionState {
// inlined. NULL when not inlining.
AstContext* call_context_;
- // Indicate if we have to drop an extra value from the environment on
- // return from inlined functions.
- bool drop_extra_;
+ // Indicate whether we have to perform special handling on return from
+ // inlined functions.
+ // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment.
+ // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value.
+ ReturnHandlingFlag return_handling_;
- // When inlining in an effect of value context, this is the return block.
+ // When inlining in an effect or value context, this is the return block.
// It is NULL otherwise. When inlining in a test context, there are a
// pair of return blocks in the context. When not inlining, there is no
// local return point.
@@ -657,14 +748,19 @@ class FunctionState {
class HGraphBuilder: public AstVisitor {
public:
enum BreakType { BREAK, CONTINUE };
+ enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH };
// A class encapsulating (lazily-allocated) break and continue blocks for
// a breakable statement. Separated from BreakAndContinueScope so that it
// can have a separate lifetime.
class BreakAndContinueInfo BASE_EMBEDDED {
public:
- explicit BreakAndContinueInfo(BreakableStatement* target)
- : target_(target), break_block_(NULL), continue_block_(NULL) {
+ explicit BreakAndContinueInfo(BreakableStatement* target,
+ int drop_extra = 0)
+ : target_(target),
+ break_block_(NULL),
+ continue_block_(NULL),
+ drop_extra_(drop_extra) {
}
BreakableStatement* target() { return target_; }
@@ -672,11 +768,13 @@ class HGraphBuilder: public AstVisitor {
void set_break_block(HBasicBlock* block) { break_block_ = block; }
HBasicBlock* continue_block() { return continue_block_; }
void set_continue_block(HBasicBlock* block) { continue_block_ = block; }
+ int drop_extra() { return drop_extra_; }
private:
BreakableStatement* target_;
HBasicBlock* break_block_;
HBasicBlock* continue_block_;
+ int drop_extra_;
};
// A helper class to maintain a stack of current BreakAndContinueInfo
@@ -695,7 +793,7 @@ class HGraphBuilder: public AstVisitor {
BreakAndContinueScope* next() { return next_; }
// Search the break stack for a break or continue target.
- HBasicBlock* Get(BreakableStatement* stmt, BreakType type);
+ HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra);
private:
BreakAndContinueInfo* info_;
@@ -738,6 +836,8 @@ class HGraphBuilder: public AstVisitor {
FunctionState* function_state() const { return function_state_; }
+ void VisitDeclarations(ZoneList<Declaration*>* declarations);
+
private:
// Type of a member function that generates inline code for a native function.
typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call);
@@ -755,6 +855,12 @@ class HGraphBuilder: public AstVisitor {
static const int kMaxInlinedSize = 196;
static const int kMaxSourceSize = 600;
+ // Even in the 'unlimited' case we have to have some limit in order not to
+ // overflow the stack.
+ static const int kUnlimitedMaxInlinedNodes = 1000;
+ static const int kUnlimitedMaxInlinedSize = 1000;
+ static const int kUnlimitedMaxSourceSize = 600;
+
// Simple accessors.
void set_function_state(FunctionState* state) { function_state_ = state; }
@@ -765,7 +871,6 @@ class HGraphBuilder: public AstVisitor {
CompilationInfo* info() const {
return function_state()->compilation_info();
}
-
AstContext* call_context() const {
return function_state()->call_context();
}
@@ -779,7 +884,8 @@ class HGraphBuilder: public AstVisitor {
function_state()->ClearInlinedTestContext();
}
StrictModeFlag function_strict_mode_flag() {
- return function_state()->compilation_info()->strict_mode_flag();
+ return function_state()->compilation_info()->is_classic_mode()
+ ? kNonStrictMode : kStrictMode;
}
// Generators for inline runtime functions.
@@ -792,7 +898,8 @@ class HGraphBuilder: public AstVisitor {
void HandleDeclaration(VariableProxy* proxy,
VariableMode mode,
- FunctionLiteral* function);
+ FunctionLiteral* function,
+ int* global_count);
void VisitDelete(UnaryOperation* expr);
void VisitVoid(UnaryOperation* expr);
@@ -806,7 +913,7 @@ class HGraphBuilder: public AstVisitor {
void VisitLogicalExpression(BinaryOperation* expr);
void VisitArithmeticExpression(BinaryOperation* expr);
- void PreProcessOsrEntry(IterationStatement* statement);
+ bool PreProcessOsrEntry(IterationStatement* statement);
// True iff. we are compiling for OSR and the statement is the entry.
bool HasOsrEntryAt(IterationStatement* statement);
void VisitLoopBody(IterationStatement* stmt,
@@ -860,7 +967,7 @@ class HGraphBuilder: public AstVisitor {
// Remove the arguments from the bailout environment and emit instructions
// to push them as outgoing parameters.
- template <int V> HInstruction* PreProcessCall(HCall<V>* call);
+ template <class Instruction> HInstruction* PreProcessCall(Instruction* call);
void TraceRepresentation(Token::Value op,
TypeInfo info,
@@ -868,7 +975,7 @@ class HGraphBuilder: public AstVisitor {
Representation rep);
static Representation ToRepresentation(TypeInfo info);
- void SetupScope(Scope* scope);
+ void SetUpScope(Scope* scope);
virtual void VisitStatements(ZoneList<Statement*>* statements);
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
@@ -892,11 +999,21 @@ class HGraphBuilder: public AstVisitor {
// Try to optimize fun.apply(receiver, arguments) pattern.
bool TryCallApply(Call* expr);
- bool TryInline(Call* expr, bool drop_extra = false);
- bool TryInlineBuiltinFunction(Call* expr,
- HValue* receiver,
- Handle<Map> receiver_map,
- CheckType check_type);
+ bool TryInline(CallKind call_kind,
+ Handle<JSFunction> target,
+ ZoneList<Expression*>* arguments,
+ HValue* receiver,
+ int ast_id,
+ int return_id,
+ ReturnHandlingFlag return_handling);
+
+ bool TryInlineCall(Call* expr, bool drop_extra = false);
+ bool TryInlineConstruct(CallNew* expr, HValue* receiver);
+ bool TryInlineBuiltinMethodCall(Call* expr,
+ HValue* receiver,
+ Handle<Map> receiver_map,
+ CheckType check_type);
+ bool TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra);
// If --trace-inlining, print a line of the inlining trace. Inlining
// succeeded if the reason string is NULL and failed if there is a
@@ -912,6 +1029,10 @@ class HGraphBuilder: public AstVisitor {
void HandlePropertyAssignment(Assignment* expr);
void HandleCompoundAssignment(Assignment* expr);
+ void HandlePolymorphicLoadNamedField(Property* expr,
+ HValue* object,
+ SmallMapList* types,
+ Handle<String> name);
void HandlePolymorphicStoreNamedField(Assignment* expr,
HValue* object,
HValue* value,
@@ -986,6 +1107,9 @@ class HGraphBuilder: public AstVisitor {
HInstruction* BuildStoreNamed(HValue* object,
HValue* value,
Expression* expr);
+ HInstruction* BuildStoreNamed(HValue* object,
+ HValue* value,
+ ObjectLiteral::Property* prop);
HInstruction* BuildStoreNamedField(HValue* object,
Handle<String> name,
HValue* value,
@@ -1054,10 +1178,10 @@ class HValueMap: public ZoneObject {
Resize(kInitialSize);
}
- void Kill(int flags);
+ void Kill(GVNFlagSet flags);
void Add(HValue* value) {
- present_flags_ |= value->flags();
+ present_flags_.Add(value->gvn_flags());
Insert(value);
}
@@ -1090,7 +1214,8 @@ class HValueMap: public ZoneObject {
int array_size_;
int lists_size_;
int count_; // The number of values stored in the HValueMap.
- int present_flags_; // All flags that are in any value in the HValueMap.
+ GVNFlagSet present_flags_; // All flags that are in any value in the
+ // HValueMap.
HValueMapListElement* array_; // Primary store - contains the first value
// with a given hash. Colliding elements are stored in linked lists.
HValueMapListElement* lists_; // The linked lists containing hash collisions.