| Index: src/hydrogen.h
|
| ===================================================================
|
| --- src/hydrogen.h (revision 7948)
|
| +++ src/hydrogen.h (working copy)
|
| @@ -30,9 +30,11 @@
|
|
|
| #include "v8.h"
|
|
|
| +#include "allocation.h"
|
| #include "ast.h"
|
| #include "compiler.h"
|
| #include "hydrogen-instructions.h"
|
| +#include "type-info.h"
|
| #include "zone.h"
|
|
|
| namespace v8 {
|
| @@ -124,8 +126,8 @@
|
| void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); }
|
| void AssignCommonDominator(HBasicBlock* other);
|
|
|
| - void FinishExitWithDeoptimization() {
|
| - FinishExit(CreateDeoptimize());
|
| + void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) {
|
| + FinishExit(CreateDeoptimize(has_uses));
|
| }
|
|
|
| // Add the inlined function exit sequence, adding an HLeaveInlined
|
| @@ -152,7 +154,7 @@
|
| void AddDominatedBlock(HBasicBlock* block);
|
|
|
| HSimulate* CreateSimulate(int id);
|
| - HDeoptimize* CreateDeoptimize();
|
| + HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses);
|
|
|
| int block_id_;
|
| HGraph* graph_;
|
| @@ -321,6 +323,7 @@
|
| return &assigned_variables_;
|
| }
|
| int parameter_count() const { return parameter_count_; }
|
| + int specials_count() const { return specials_count_; }
|
| int local_count() const { return local_count_; }
|
| HEnvironment* outer() const { return outer_; }
|
| int pop_count() const { return pop_count_; }
|
| @@ -330,6 +333,9 @@
|
| void set_ast_id(int id) { ast_id_ = id; }
|
|
|
| int length() const { return values_.length(); }
|
| + bool is_special_index(int i) const {
|
| + return i >= parameter_count() && i < parameter_count() + specials_count();
|
| + }
|
|
|
| void Bind(Variable* variable, HValue* value) {
|
| Bind(IndexFor(variable), value);
|
| @@ -337,6 +343,10 @@
|
|
|
| void Bind(int index, HValue* value);
|
|
|
| + void BindContext(HValue* value) {
|
| + Bind(parameter_count(), value);
|
| + }
|
| +
|
| HValue* Lookup(Variable* variable) const {
|
| return Lookup(IndexFor(variable));
|
| }
|
| @@ -347,6 +357,11 @@
|
| return result;
|
| }
|
|
|
| + HValue* LookupContext() const {
|
| + // Return first special.
|
| + return Lookup(parameter_count());
|
| + }
|
| +
|
| void Push(HValue* value) {
|
| ASSERT(value != NULL);
|
| ++push_count_;
|
| @@ -367,6 +382,8 @@
|
|
|
| HValue* Top() const { return ExpressionStackAt(0); }
|
|
|
| + bool ExpressionStackIsEmpty() const;
|
| +
|
| HValue* ExpressionStackAt(int index_from_top) const {
|
| int index = length() - index_from_top - 1;
|
| ASSERT(HasExpressionAt(index));
|
| @@ -411,8 +428,6 @@
|
| // True if index is included in the expression stack part of the environment.
|
| bool HasExpressionAt(int index) const;
|
|
|
| - bool ExpressionStackIsEmpty() const;
|
| -
|
| void Initialize(int parameter_count, int local_count, int stack_height);
|
| void Initialize(const HEnvironment* other);
|
|
|
| @@ -422,15 +437,18 @@
|
| int IndexFor(Variable* variable) const {
|
| Slot* slot = variable->AsSlot();
|
| ASSERT(slot != NULL && slot->IsStackAllocated());
|
| - int shift = (slot->type() == Slot::PARAMETER) ? 1 : parameter_count_;
|
| + int shift = (slot->type() == Slot::PARAMETER)
|
| + ? 1
|
| + : parameter_count_ + specials_count_;
|
| return slot->index() + shift;
|
| }
|
|
|
| Handle<JSFunction> closure_;
|
| - // Value array [parameters] [locals] [temporaries].
|
| + // Value array [parameters] [specials] [locals] [temporaries].
|
| ZoneList<HValue*> values_;
|
| ZoneList<int> assigned_variables_;
|
| int parameter_count_;
|
| + int specials_count_;
|
| int local_count_;
|
| HEnvironment* outer_;
|
| int pop_count_;
|
| @@ -734,6 +752,18 @@
|
| INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
|
| #undef INLINE_FUNCTION_GENERATOR_DECLARATION
|
|
|
| + void VisitDelete(UnaryOperation* expr);
|
| + void VisitVoid(UnaryOperation* expr);
|
| + void VisitTypeof(UnaryOperation* expr);
|
| + void VisitAdd(UnaryOperation* expr);
|
| + void VisitSub(UnaryOperation* expr);
|
| + void VisitBitNot(UnaryOperation* expr);
|
| + void VisitNot(UnaryOperation* expr);
|
| +
|
| + void VisitComma(BinaryOperation* expr);
|
| + void VisitAndOr(BinaryOperation* expr, bool is_logical_and);
|
| + void VisitCommon(BinaryOperation* expr);
|
| +
|
| void PreProcessOsrEntry(IterationStatement* statement);
|
| // True iff. we are compiling for OSR and the statement is the entry.
|
| bool HasOsrEntryAt(IterationStatement* statement);
|
| @@ -790,7 +820,11 @@
|
| // to push them as outgoing parameters.
|
| template <int V> HInstruction* PreProcessCall(HCall<V>* call);
|
|
|
| - void AssumeRepresentation(HValue* value, Representation r);
|
| + void TraceRepresentation(Token::Value op,
|
| + TypeInfo info,
|
| + HValue* value,
|
| + Representation rep);
|
| + void AssumeRepresentation(HValue* value, Representation rep);
|
| static Representation ToRepresentation(TypeInfo info);
|
|
|
| void SetupScope(Scope* scope);
|
| @@ -842,13 +876,19 @@
|
| ZoneMapList* types,
|
| Handle<String> name);
|
|
|
| + HCompareSymbolEq* BuildSymbolCompare(HValue* left,
|
| + HValue* right,
|
| + Token::Value op);
|
| HStringCharCodeAt* BuildStringCharCodeAt(HValue* string,
|
| HValue* index);
|
| HInstruction* BuildBinaryOperation(BinaryOperation* expr,
|
| HValue* left,
|
| HValue* right);
|
| - HInstruction* BuildIncrement(HValue* value,
|
| - bool increment,
|
| + HInstruction* BuildBinaryOperation(Token::Value op,
|
| + HValue* left,
|
| + HValue* right,
|
| + TypeInfo info);
|
| + HInstruction* BuildIncrement(bool returns_original_input,
|
| CountOperation* expr);
|
| HLoadNamedField* BuildLoadNamedField(HValue* object,
|
| Property* expr,
|
| @@ -968,9 +1008,11 @@
|
| HValue* Lookup(HValue* value) const;
|
|
|
| HValueMap* Copy(Zone* zone) const {
|
| - return new(zone) HValueMap(this);
|
| + return new(zone) HValueMap(zone, this);
|
| }
|
|
|
| + bool IsEmpty() const { return count_ == 0; }
|
| +
|
| private:
|
| // A linked list of HValue* values. Stored in arrays.
|
| struct HValueMapListElement {
|
| @@ -982,7 +1024,7 @@
|
| // Must be a power of 2.
|
| static const int kInitialSize = 16;
|
|
|
| - explicit HValueMap(const HValueMap* other);
|
| + HValueMap(Zone* zone, const HValueMap* other);
|
|
|
| void Resize(int new_size);
|
| void ResizeLists(int new_size);
|
|
|