Revision: 18905
Author: [email protected]
Date: Wed Jan 29 13:41:00 2014 UTC
Log: Remove the HValueOf instruction.
[email protected]
Review URL: https://codereview.chromium.org/139233004
http://code.google.com/p/v8/source/detail?r=18905
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
/branches/bleeding_edge/src/mips/lithium-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.h
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Jan 29 12:48:32 2014
UTC
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Jan 29 13:41:00 2014
UTC
@@ -1709,13 +1709,6 @@
LOperand* object = UseRegisterAtStart(instr->value());
return DefineAsRegister(new(zone()) LElementsKind(object));
}
-
-
-LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
- LOperand* object = UseRegister(instr->value());
- LValueOf* result = new(zone()) LValueOf(object, TempRegister());
- return DefineAsRegister(result);
-}
LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Wed Jan 29 07:27:35 2014
UTC
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Wed Jan 29 13:41:00 2014
UTC
@@ -177,7 +177,6 @@
V(Uint32ToDouble) \
V(Uint32ToSmi) \
V(UnknownOSRValue) \
- V(ValueOf) \
V(WrapReceiver)
@@ -1308,21 +1307,6 @@
};
-class LValueOf V8_FINAL : public LTemplateInstruction<1, 1, 1> {
- public:
- LValueOf(LOperand* value, LOperand* temp) {
- inputs_[0] = value;
- temps_[0] = temp;
- }
-
- LOperand* value() { return inputs_[0]; }
- LOperand* temp() { return temps_[0]; }
-
- DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
- DECLARE_HYDROGEN_ACCESSOR(ValueOf)
-};
-
-
class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
public:
LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Jan 29
13:10:35 2014 UTC
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Jan 29
13:41:00 2014 UTC
@@ -1876,28 +1876,6 @@
// Retrieve elements_kind from bit field 2.
__ ubfx(result, result, Map::kElementsKindShift,
Map::kElementsKindBitCount);
}
-
-
-void LCodeGen::DoValueOf(LValueOf* instr) {
- Register input = ToRegister(instr->value());
- Register result = ToRegister(instr->result());
- Register map = ToRegister(instr->temp());
- Label done;
-
- if (!instr->hydrogen()->value()->IsHeapObject()) {
- // If the object is a smi return the object.
- __ SmiTst(input);
- __ Move(result, input, eq);
- __ b(eq, &done);
- }
-
- // If the object is not a value type, return the object.
- __ CompareObjectType(input, map, map, JS_VALUE_TYPE);
- __ Move(result, input, ne);
- __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset), eq);
-
- __ bind(&done);
-}
void LCodeGen::DoDateField(LDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Jan 29 13:10:35
2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Jan 29 13:41:00
2014 UTC
@@ -181,7 +181,6 @@
V(UnaryMathOperation) \
V(UnknownOSRValue) \
V(UseConst) \
- V(ValueOf) \
V(WrapReceiver)
#define GVN_TRACKED_FLAG_LIST(V) \
@@ -7200,25 +7199,6 @@
ASSERT(function->function_id == Runtime::kCreateObjectLiteral);
#endif
}
-
- virtual bool IsDeletable() const V8_OVERRIDE { return true; }
-};
-
-
-class HValueOf V8_FINAL : public HUnaryOperation {
- public:
- DECLARE_INSTRUCTION_FACTORY_P1(HValueOf, HValue*);
-
- virtual Representation RequiredInputRepresentation(int index)
V8_OVERRIDE {
- return Representation::Tagged();
- }
-
- DECLARE_CONCRETE_INSTRUCTION(ValueOf)
-
- private:
- explicit HValueOf(HValue* value) : HUnaryOperation(value) {
- set_representation(Representation::Tagged());
- }
virtual bool IsDeletable() const V8_OVERRIDE { return true; }
};
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Wed Jan 29 13:10:35 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Wed Jan 29 13:41:00 2014 UTC
@@ -10313,9 +10313,27 @@
void HOptimizedGraphBuilder::GenerateValueOf(CallRuntime* call) {
ASSERT(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
- HValue* value = Pop();
- HValueOf* result = New<HValueOf>(value);
- return ast_context()->ReturnInstruction(result, call->id());
+ HValue* object = Pop();
+
+ IfBuilder if_objectisvalue(this);
+ HValue* objectisvalue = if_objectisvalue.If<HHasInstanceTypeAndBranch>(
+ object, JS_VALUE_TYPE);
+ if_objectisvalue.Then();
+ {
+ // Return the actual value.
+ Push(Add<HLoadNamedField>(
+ object, objectisvalue,
+ HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset)));
+ Add<HSimulate>(call->id(), FIXED_SIMULATE);
+ }
+ if_objectisvalue.Else();
+ {
+ // If the object is not a value return the object.
+ Push(object);
+ Add<HSimulate>(call->id(), FIXED_SIMULATE);
+ }
+ if_objectisvalue.End();
+ return ast_context()->ReturnValue(Pop());
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Jan 29
13:10:35 2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Jan 29
13:41:00 2014 UTC
@@ -1981,28 +1981,6 @@
__ and_(result, Map::kElementsKindMask);
__ shr(result, Map::kElementsKindShift);
}
-
-
-void LCodeGen::DoValueOf(LValueOf* instr) {
- Register input = ToRegister(instr->value());
- Register result = ToRegister(instr->result());
- Register map = ToRegister(instr->temp());
- ASSERT(input.is(result));
-
- Label done;
-
- if (!instr->hydrogen()->value()->IsHeapObject()) {
- // If the object is a smi return the object.
- __ JumpIfSmi(input, &done, Label::kNear);
- }
-
- // If the object is not a value type, return the object.
- __ CmpObjectType(input, JS_VALUE_TYPE, map);
- __ j(not_equal, &done, Label::kNear);
- __ mov(result, FieldOperand(input, JSValue::kValueOffset));
-
- __ bind(&done);
-}
void LCodeGen::DoDateField(LDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Jan 29 12:48:32
2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Jan 29 13:41:00
2014 UTC
@@ -1701,13 +1701,6 @@
LOperand* object = UseRegisterAtStart(instr->value());
return DefineAsRegister(new(zone()) LElementsKind(object));
}
-
-
-LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
- LOperand* object = UseRegister(instr->value());
- LValueOf* result = new(zone()) LValueOf(object, TempRegister());
- return DefineSameAsFirst(result);
-}
LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Jan 29 07:27:35
2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Jan 29 13:41:00
2014 UTC
@@ -176,7 +176,6 @@
V(Uint32ToDouble) \
V(Uint32ToSmi) \
V(UnknownOSRValue) \
- V(ValueOf) \
V(WrapReceiver)
@@ -1281,21 +1280,6 @@
};
-class LValueOf V8_FINAL : public LTemplateInstruction<1, 1, 1> {
- public:
- LValueOf(LOperand* value, LOperand* temp) {
- inputs_[0] = value;
- temps_[0] = temp;
- }
-
- LOperand* value() { return inputs_[0]; }
- LOperand* temp() { return temps_[0]; }
-
- DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
- DECLARE_HYDROGEN_ACCESSOR(ValueOf)
-};
-
-
class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
public:
LDateField(LOperand* date, LOperand* temp, Smi* index)
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Jan 29 12:48:32
2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Jan 29 13:41:00
2014 UTC
@@ -1637,13 +1637,6 @@
LOperand* object = UseRegisterAtStart(instr->value());
return DefineAsRegister(new(zone()) LElementsKind(object));
}
-
-
-LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
- LOperand* object = UseRegister(instr->value());
- LValueOf* result = new(zone()) LValueOf(object, TempRegister());
- return DefineAsRegister(result);
-}
LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h Wed Jan 29 07:27:35
2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.h Wed Jan 29 13:41:00
2014 UTC
@@ -175,7 +175,6 @@
V(Uint32ToDouble) \
V(Uint32ToSmi) \
V(UnknownOSRValue) \
- V(ValueOf) \
V(WrapReceiver)
#define DECLARE_CONCRETE_INSTRUCTION(type,
mnemonic) \
@@ -1288,21 +1287,6 @@
};
-class LValueOf V8_FINAL : public LTemplateInstruction<1, 1, 1> {
- public:
- LValueOf(LOperand* value, LOperand* temp) {
- inputs_[0] = value;
- temps_[0] = temp;
- }
-
- LOperand* value() { return inputs_[0]; }
- LOperand* temp() { return temps_[0]; }
-
- DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
- DECLARE_HYDROGEN_ACCESSOR(ValueOf)
-};
-
-
class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
public:
LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Jan 29
13:10:35 2014 UTC
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Jan 29
13:41:00 2014 UTC
@@ -1586,26 +1586,6 @@
__ and_(result, Immediate(Map::kElementsKindMask));
__ shr(result, Immediate(Map::kElementsKindShift));
}
-
-
-void LCodeGen::DoValueOf(LValueOf* instr) {
- Register input = ToRegister(instr->value());
- Register result = ToRegister(instr->result());
- ASSERT(input.is(result));
- Label done;
-
- if (!instr->hydrogen()->value()->IsHeapObject()) {
- // If the object is a smi return the object.
- __ JumpIfSmi(input, &done, Label::kNear);
- }
-
- // If the object is not a value type, return the object.
- __ CmpObjectType(input, JS_VALUE_TYPE, kScratchRegister);
- __ j(not_equal, &done, Label::kNear);
- __ movp(result, FieldOperand(input, JSValue::kValueOffset));
-
- __ bind(&done);
-}
void LCodeGen::DoDateField(LDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Jan 29 12:48:32 2014
UTC
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Jan 29 13:41:00 2014
UTC
@@ -1610,13 +1610,6 @@
LOperand* object = UseRegisterAtStart(instr->value());
return DefineAsRegister(new(zone()) LElementsKind(object));
}
-
-
-LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
- LOperand* object = UseRegister(instr->value());
- LValueOf* result = new(zone()) LValueOf(object);
- return DefineSameAsFirst(result);
-}
LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Wed Jan 29 07:27:35 2014
UTC
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Wed Jan 29 13:41:00 2014
UTC
@@ -174,7 +174,6 @@
V(Uint32ToDouble) \
V(Uint32ToSmi) \
V(UnknownOSRValue) \
- V(ValueOf) \
V(WrapReceiver)
@@ -1249,19 +1248,6 @@
};
-class LValueOf V8_FINAL : public LTemplateInstruction<1, 1, 0> {
- public:
- explicit LValueOf(LOperand* value) {
- inputs_[0] = value;
- }
-
- LOperand* value() { return inputs_[0]; }
-
- DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
- DECLARE_HYDROGEN_ACCESSOR(ValueOf)
-};
-
-
class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
LDateField(LOperand* date, Smi* index) : index_(index) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.