void ComputeInitialRange();
// Representation helpers.
- virtual Representation RequiredInputRepresentation(int index) const {
- return Representation::None();
- }
+ virtual Representation RequiredInputRepresentation(int index) const = 0;
+
virtual Representation InferredRepresentation() {
return representation();
}
class HBlockEntry: public HInstruction {
public:
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
};
public:
HDeoptimize() : HControlInstruction(NULL, NULL) { }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
};
}
bool include_stack_check() const { return include_stack_check_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
private:
SetOperandAt(0, value);
}
- virtual Representation RequiredInputRepresentation(int index) const {
- return Representation::Tagged();
- }
-
virtual void PrintDataTo(StringStream* stream);
HValue* value() { return OperandAt(0); }
Handle<Map> map() const { return map_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
private:
: HUnaryControlInstruction(value, NULL, NULL) {
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Return, "return")
};
public:
HAbnormalExit() : HControlInstruction(NULL, NULL) { }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit")
};
virtual int OperandCount() { return values_.length(); }
virtual HValue* OperandAt(int index) { return values_[index]; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate")
#ifdef DEBUG
public:
HStackCheck() { }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check")
};
Handle<JSFunction> closure() const { return closure_; }
FunctionLiteral* function() const { return function_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined")
private:
public:
HLeaveInlined() {}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(LeaveInlined, "leave_inlined")
};
SetFlag(kUseGVN);
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Context, "context");
protected:
DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context");
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
protected:
virtual bool DataEquals(HValue* other) { return true; }
};
DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object")
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
protected:
virtual bool DataEquals(HValue* other) { return true; }
};
DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver")
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
protected:
virtual bool DataEquals(HValue* other) { return true; }
};
virtual void PrintDataTo(StringStream* stream);
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function")
private:
DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named")
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
private:
Handle<String> name_;
};
HValue* context() { return value(); }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function")
};
HValue* context() { return value(); }
Handle<String> name() const { return name_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global")
private:
Handle<JSFunction> target() const { return target_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global")
private:
Runtime::Function* function() const { return c_function_; }
Handle<String> name() const { return name_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime")
private:
case kMathSin:
case kMathCos:
return Representation::Double();
- break;
case kMathAbs:
return representation();
- break;
default:
+ UNREACHABLE();
return Representation::None();
}
}
DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps")
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
virtual intptr_t Hashcode() {
ASSERT(!Heap::IsAllocationAllowed());
intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
SetFlag(kIsArguments);
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object")
};
bool InOldSpace() const { return !Heap::InNewSpace(*handle_); }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
virtual bool EmitAtUses() const { return !representation().IsDouble(); }
virtual void PrintDataTo(StringStream* stream);
virtual HType CalculateInferredType();
DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements")
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
protected:
virtual bool DataEquals(HValue* other) { return true; }
};
DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
protected:
virtual bool DataEquals(HValue* other) { return true; }
};
return !HasSideEffects() && (uses()->length() <= 1);
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call")
protected:
int ast_id() const { return ast_id_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry")
private:
virtual void PrintDataTo(StringStream* stream);
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
private:
virtual void PrintDataTo(StringStream* stream);
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub")
private:
public:
HUnknownOSRValue() { set_representation(Representation::Tagged()); }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value")
};
Handle<JSGlobalPropertyCell> cell() const { return cell_; }
bool check_hole_value() const { return check_hole_value_; }
- virtual Representation RequiredInputRepresentation(int index) const {
- return Representation::Tagged();
- }
virtual void PrintDataTo(StringStream* stream);
virtual intptr_t Hashcode() {
return reinterpret_cast<intptr_t>(*cell_);
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global")
protected:
bool IsCopyOnWrite() const;
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal")
private:
virtual int OperandCount() { return 1; }
virtual HValue* OperandAt(int index) { return context_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal")
protected:
Handle<String> pattern() { return pattern_; }
Handle<String> flags() { return flags_; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp_literal")
private:
set_representation(Representation::Tagged());
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function_literal")
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
set_representation(Representation::Tagged());
}
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value_of")
};
--- /dev/null
+// Copyright 2011 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:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Test valueof with integer input.
+function f(x) { var y = x + 1; return %_ValueOf(y); }
+
+for (var i=0; i<100000; i++) f(42);
+
+assertEquals(43, f(42));