From 0737ec8dcba291ec85c5285f91850ae0f7dcd77f Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Thu, 25 Mar 2010 12:44:15 +0000 Subject: [PATCH] Rename NumberInfo to TypeInfo. Since we add more type (StringType, PrimitiveType) the name NumberInfo does not make sense anymore. Review URL: http://codereview.chromium.org/1207006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4268 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/virtual-frame-arm.cc | 2 +- src/arm/virtual-frame-arm.h | 8 +- src/codegen.h | 2 +- src/frame-element.h | 34 +-- src/ia32/codegen-ia32.cc | 256 ++++++++++----------- src/ia32/codegen-ia32.h | 10 +- src/ia32/full-codegen-ia32.cc | 4 +- src/ia32/register-allocator-ia32.cc | 4 +- src/ia32/virtual-frame-ia32.cc | 34 +-- src/ia32/virtual-frame-ia32.h | 18 +- src/jump-target-inl.h | 2 +- src/jump-target.cc | 24 +- src/register-allocator-inl.h | 18 +- src/register-allocator.cc | 4 +- src/register-allocator.h | 14 +- src/{number-info-inl.h => type-info-inl.h} | 22 +- src/{number-info.h => type-info.h} | 74 +++--- src/virtual-frame-inl.h | 12 +- src/virtual-frame.cc | 16 +- src/x64/codegen-x64.cc | 28 +-- src/x64/codegen-x64.h | 6 +- src/x64/register-allocator-x64.cc | 4 +- src/x64/virtual-frame-x64.cc | 34 +-- src/x64/virtual-frame-x64.h | 20 +- tools/gyp/v8.gyp | 4 +- tools/visual_studio/v8_base.vcproj | 16 +- tools/visual_studio/v8_base_arm.vcproj | 16 +- tools/visual_studio/v8_base_x64.vcproj | 16 +- 28 files changed, 351 insertions(+), 351 deletions(-) rename src/{number-info-inl.h => type-info-inl.h} (81%) rename src/{number-info.h => type-info.h} (80%) diff --git a/src/arm/virtual-frame-arm.cc b/src/arm/virtual-frame-arm.cc index ab6e5f813..8077d6c98 100644 --- a/src/arm/virtual-frame-arm.cc +++ b/src/arm/virtual-frame-arm.cc @@ -295,7 +295,7 @@ void VirtualFrame::EmitPop(Register reg) { void VirtualFrame::EmitPush(Register reg) { ASSERT(stack_pointer_ == element_count() - 1); - elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); + elements_.Add(FrameElement::MemoryElement(TypeInfo::Unknown())); stack_pointer_++; __ push(reg); } diff --git a/src/arm/virtual-frame-arm.h b/src/arm/virtual-frame-arm.h index 9ac7a0548..16fc4995f 100644 --- a/src/arm/virtual-frame-arm.h +++ b/src/arm/virtual-frame-arm.h @@ -69,7 +69,7 @@ class VirtualFrame : public ZoneObject { // Create a duplicate of an existing valid frame element. FrameElement CopyElementAt(int index, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); // The number of elements on the virtual frame. int element_count() { return elements_.length(); } @@ -344,7 +344,7 @@ class VirtualFrame : public ZoneObject { void EmitPushMultiple(int count, int src_regs); // Push an element on the virtual frame. - inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown()); + inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown()); inline void Push(Handle value); inline void Push(Smi* value); @@ -364,8 +364,8 @@ class VirtualFrame : public ZoneObject { // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). inline void Nip(int num_dropped); - inline void SetTypeForLocalAt(int index, NumberInfo info); - inline void SetTypeForParamAt(int index, NumberInfo info); + inline void SetTypeForLocalAt(int index, TypeInfo info); + inline void SetTypeForParamAt(int index, TypeInfo info); private: static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; diff --git a/src/codegen.h b/src/codegen.h index c459280c2..4634f4c15 100644 --- a/src/codegen.h +++ b/src/codegen.h @@ -31,7 +31,7 @@ #include "ast.h" #include "code-stubs.h" #include "runtime.h" -#include "number-info.h" +#include "type-info.h" // Include the declaration of the architecture defined class CodeGenerator. // The contract to the shared code is that the the CodeGenerator is a subclass diff --git a/src/frame-element.h b/src/frame-element.h index 3714ac9e6..83db5c334 100644 --- a/src/frame-element.h +++ b/src/frame-element.h @@ -28,7 +28,7 @@ #ifndef V8_FRAME_ELEMENT_H_ #define V8_FRAME_ELEMENT_H_ -#include "number-info-inl.h" +#include "type-info-inl.h" #include "macro-assembler.h" #include "zone.h" @@ -54,19 +54,19 @@ class FrameElement BASE_EMBEDDED { SYNCED }; - inline NumberInfo number_info() { - // Copied elements do not have number info. Instead + inline TypeInfo type_info() { + // Copied elements do not have type info. Instead // we have to inspect their backing element in the frame. ASSERT(!is_copy()); - return NumberInfo::FromInt(NumberInfoField::decode(value_)); + return TypeInfo::FromInt(TypeInfoField::decode(value_)); } - inline void set_number_info(NumberInfo info) { - // Copied elements do not have number info. Instead + inline void set_type_info(TypeInfo info) { + // Copied elements do not have type info. Instead // we have to inspect their backing element in the frame. ASSERT(!is_copy()); - value_ = value_ & ~NumberInfoField::mask(); - value_ = value_ | NumberInfoField::encode(info.ToInt()); + value_ = value_ & ~TypeInfoField::mask(); + value_ = value_ | TypeInfoField::encode(info.ToInt()); } // The default constructor creates an invalid frame element. @@ -74,7 +74,7 @@ class FrameElement BASE_EMBEDDED { value_ = TypeField::encode(INVALID) | CopiedField::encode(false) | SyncedField::encode(false) - | NumberInfoField::encode(NumberInfo::Uninitialized().ToInt()) + | TypeInfoField::encode(TypeInfo::Uninitialized().ToInt()) | DataField::encode(0); } @@ -85,7 +85,7 @@ class FrameElement BASE_EMBEDDED { } // Factory function to construct an in-memory frame element. - static FrameElement MemoryElement(NumberInfo info) { + static FrameElement MemoryElement(TypeInfo info) { FrameElement result(MEMORY, no_reg, SYNCED, info); return result; } @@ -93,7 +93,7 @@ class FrameElement BASE_EMBEDDED { // Factory function to construct an in-register frame element. static FrameElement RegisterElement(Register reg, SyncFlag is_synced, - NumberInfo info) { + TypeInfo info) { return FrameElement(REGISTER, reg, is_synced, info); } @@ -101,7 +101,7 @@ class FrameElement BASE_EMBEDDED { // compile time. static FrameElement ConstantElement(Handle value, SyncFlag is_synced) { - NumberInfo info = NumberInfo::TypeFromValue(value); + TypeInfo info = TypeInfo::TypeFromValue(value); FrameElement result(value, is_synced, info); return result; } @@ -218,20 +218,20 @@ class FrameElement BASE_EMBEDDED { FrameElement(Type type, Register reg, SyncFlag is_synced, - NumberInfo info) { + TypeInfo info) { value_ = TypeField::encode(type) | CopiedField::encode(false) | SyncedField::encode(is_synced != NOT_SYNCED) - | NumberInfoField::encode(info.ToInt()) + | TypeInfoField::encode(info.ToInt()) | DataField::encode(reg.code_ > 0 ? reg.code_ : 0); } // Used to construct constant elements. - FrameElement(Handle value, SyncFlag is_synced, NumberInfo info) { + FrameElement(Handle value, SyncFlag is_synced, TypeInfo info) { value_ = TypeField::encode(CONSTANT) | CopiedField::encode(false) | SyncedField::encode(is_synced != NOT_SYNCED) - | NumberInfoField::encode(info.ToInt()) + | TypeInfoField::encode(info.ToInt()) | DataField::encode(ConstantList()->length()); ConstantList()->Add(value); } @@ -262,7 +262,7 @@ class FrameElement BASE_EMBEDDED { class CopiedField: public BitField {}; class SyncedField: public BitField {}; class UntaggedInt32Field: public BitField {}; - class NumberInfoField: public BitField {}; + class TypeInfoField: public BitField {}; class DataField: public BitField {}; friend class VirtualFrame; diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc index f8ae7e41a..c79a03c8e 100644 --- a/src/ia32/codegen-ia32.cc +++ b/src/ia32/codegen-ia32.cc @@ -850,7 +850,7 @@ void CodeGenerator::ToBoolean(ControlDestination* dest) { dest->Split(not_zero); } else if (value.is_number()) { Comment cmnt(masm_, "ONLY_NUMBER"); - // Fast case if NumberInfo indicates only numbers. + // Fast case if TypeInfo indicates only numbers. if (FLAG_debug_code) { __ AbortIfNotNumber(value.reg()); } @@ -934,11 +934,11 @@ class FloatingPointHelper : public AllStatic { // Takes the operands in edx and eax and loads them as integers in eax // and ecx. static void LoadAsIntegers(MacroAssembler* masm, - NumberInfo number_info, + TypeInfo type_info, bool use_sse3, Label* operand_conversion_failure); static void LoadNumbersAsIntegers(MacroAssembler* masm, - NumberInfo number_info, + TypeInfo type_info, bool use_sse3, Label* operand_conversion_failure); static void LoadUnknownsAsIntegers(MacroAssembler* masm, @@ -996,8 +996,8 @@ class DeferredInlineBinaryOperation: public DeferredCode { Register dst, Register left, Register right, - NumberInfo left_info, - NumberInfo right_info, + TypeInfo left_info, + TypeInfo right_info, OverwriteMode mode) : op_(op), dst_(dst), left_(left), right_(right), left_info_(left_info), right_info_(right_info), mode_(mode) { @@ -1011,8 +1011,8 @@ class DeferredInlineBinaryOperation: public DeferredCode { Register dst_; Register left_; Register right_; - NumberInfo left_info_; - NumberInfo right_info_; + TypeInfo left_info_; + TypeInfo right_info_; OverwriteMode mode_; }; @@ -1106,23 +1106,23 @@ void DeferredInlineBinaryOperation::Generate() { GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB, - NumberInfo::Combine(left_info_, right_info_)); + TypeInfo::Combine(left_info_, right_info_)); stub.GenerateCall(masm_, left_, right_); if (!dst_.is(eax)) __ mov(dst_, eax); __ bind(&done); } -static NumberInfo CalculateNumberInfo(NumberInfo operands_type, +static TypeInfo CalculateTypeInfo(TypeInfo operands_type, Token::Value op, const Result& right, const Result& left) { - // Set NumberInfo of result according to the operation performed. + // Set TypeInfo of result according to the operation performed. // Rely on the fact that smis have a 31 bit payload on ia32. ASSERT(kSmiValueSize == 31); switch (op) { case Token::COMMA: - return right.number_info(); + return right.type_info(); case Token::OR: case Token::AND: // Result type can be either of the two input types. @@ -1131,74 +1131,74 @@ static NumberInfo CalculateNumberInfo(NumberInfo operands_type, // Anding with positive Smis will give you a Smi. if (right.is_constant() && right.handle()->IsSmi() && Smi::cast(*right.handle())->value() >= 0) { - return NumberInfo::Smi(); + return TypeInfo::Smi(); } else if (left.is_constant() && left.handle()->IsSmi() && Smi::cast(*left.handle())->value() >= 0) { - return NumberInfo::Smi(); + return TypeInfo::Smi(); } return (operands_type.IsSmi()) - ? NumberInfo::Smi() - : NumberInfo::Integer32(); + ? TypeInfo::Smi() + : TypeInfo::Integer32(); } case Token::BIT_OR: { // Oring with negative Smis will give you a Smi. if (right.is_constant() && right.handle()->IsSmi() && Smi::cast(*right.handle())->value() < 0) { - return NumberInfo::Smi(); + return TypeInfo::Smi(); } else if (left.is_constant() && left.handle()->IsSmi() && Smi::cast(*left.handle())->value() < 0) { - return NumberInfo::Smi(); + return TypeInfo::Smi(); } return (operands_type.IsSmi()) - ? NumberInfo::Smi() - : NumberInfo::Integer32(); + ? TypeInfo::Smi() + : TypeInfo::Integer32(); } case Token::BIT_XOR: // Result is always a 32 bit integer. Smi property of inputs is preserved. return (operands_type.IsSmi()) - ? NumberInfo::Smi() - : NumberInfo::Integer32(); + ? TypeInfo::Smi() + : TypeInfo::Integer32(); case Token::SAR: - if (left.is_smi()) return NumberInfo::Smi(); + if (left.is_smi()) return TypeInfo::Smi(); // Result is a smi if we shift by a constant >= 1, otherwise an integer32. return (right.is_constant() && right.handle()->IsSmi() && Smi::cast(*right.handle())->value() >= 1) - ? NumberInfo::Smi() - : NumberInfo::Integer32(); + ? TypeInfo::Smi() + : TypeInfo::Integer32(); case Token::SHR: // Result is a smi if we shift by a constant >= 2, otherwise an integer32. return (right.is_constant() && right.handle()->IsSmi() && Smi::cast(*right.handle())->value() >= 2) - ? NumberInfo::Smi() - : NumberInfo::Integer32(); + ? TypeInfo::Smi() + : TypeInfo::Integer32(); case Token::ADD: if (operands_type.IsSmi()) { // The Integer32 range is big enough to take the sum of any two Smis. - return NumberInfo::Integer32(); + return TypeInfo::Integer32(); } else { // Result could be a string or a number. Check types of inputs. return operands_type.IsNumber() - ? NumberInfo::Number() - : NumberInfo::Unknown(); + ? TypeInfo::Number() + : TypeInfo::Unknown(); } case Token::SHL: - return NumberInfo::Integer32(); + return TypeInfo::Integer32(); case Token::SUB: // The Integer32 range is big enough to take the difference of any two // Smis. return (operands_type.IsSmi()) ? - NumberInfo::Integer32() : - NumberInfo::Number(); + TypeInfo::Integer32() : + TypeInfo::Number(); case Token::MUL: case Token::DIV: case Token::MOD: // Result is always a number. - return NumberInfo::Number(); + return TypeInfo::Number(); default: UNREACHABLE(); } UNREACHABLE(); - return NumberInfo::Unknown(); + return TypeInfo::Unknown(); } @@ -1258,10 +1258,10 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op, } // Get number type of left and right sub-expressions. - NumberInfo operands_type = - NumberInfo::Combine(left.number_info(), right.number_info()); + TypeInfo operands_type = + TypeInfo::Combine(left.type_info(), right.type_info()); - NumberInfo result_type = CalculateNumberInfo(operands_type, op, right, left); + TypeInfo result_type = CalculateTypeInfo(operands_type, op, right, left); Result answer; if (left_is_non_smi_constant || right_is_non_smi_constant) { @@ -1300,7 +1300,7 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op, } } - answer.set_number_info(result_type); + answer.set_type_info(result_type); frame_->Push(&answer); } @@ -1388,7 +1388,7 @@ bool CodeGenerator::FoldConstantSmis(Token::Value op, int left, int right) { static void CheckTwoForSminess(MacroAssembler* masm, Register left, Register right, Register scratch, - NumberInfo left_info, NumberInfo right_info, + TypeInfo left_info, TypeInfo right_info, DeferredInlineBinaryOperation* deferred); @@ -1473,8 +1473,8 @@ Result CodeGenerator::LikelySmiBinaryOperation(Token::Value op, (op == Token::DIV) ? eax : edx, left->reg(), right->reg(), - left->number_info(), - right->number_info(), + left->type_info(), + right->type_info(), overwrite_mode); if (left->reg().is(right->reg())) { __ test(left->reg(), Immediate(kSmiTagMask)); @@ -1577,18 +1577,18 @@ Result CodeGenerator::LikelySmiBinaryOperation(Token::Value op, answer.reg(), left->reg(), ecx, - left->number_info(), - right->number_info(), + left->type_info(), + right->type_info(), overwrite_mode); Label do_op, left_nonsmi; // If right is a smi we make a fast case if left is either a smi // or a heapnumber. - if (CpuFeatures::IsSupported(SSE2) && right->number_info().IsSmi()) { + if (CpuFeatures::IsSupported(SSE2) && right->type_info().IsSmi()) { CpuFeatures::Scope use_sse2(SSE2); __ mov(answer.reg(), left->reg()); // Fast case - both are actually smis. - if (!left->number_info().IsSmi()) { + if (!left->type_info().IsSmi()) { __ test(answer.reg(), Immediate(kSmiTagMask)); __ j(not_zero, &left_nonsmi); } else { @@ -1612,7 +1612,7 @@ Result CodeGenerator::LikelySmiBinaryOperation(Token::Value op, deferred->Branch(negative); } else { CheckTwoForSminess(masm_, left->reg(), right->reg(), answer.reg(), - left->number_info(), right->number_info(), deferred); + left->type_info(), right->type_info(), deferred); // Untag both operands. __ mov(answer.reg(), left->reg()); @@ -1685,11 +1685,11 @@ Result CodeGenerator::LikelySmiBinaryOperation(Token::Value op, answer.reg(), left->reg(), right->reg(), - left->number_info(), - right->number_info(), + left->type_info(), + right->type_info(), overwrite_mode); CheckTwoForSminess(masm_, left->reg(), right->reg(), answer.reg(), - left->number_info(), right->number_info(), deferred); + left->type_info(), right->type_info(), deferred); __ mov(answer.reg(), left->reg()); switch (op) { @@ -1761,16 +1761,16 @@ class DeferredInlineSmiOperation: public DeferredCode { DeferredInlineSmiOperation(Token::Value op, Register dst, Register src, - NumberInfo number_info, + TypeInfo type_info, Smi* value, OverwriteMode overwrite_mode) : op_(op), dst_(dst), src_(src), - number_info_(number_info), + type_info_(type_info), value_(value), overwrite_mode_(overwrite_mode) { - if (number_info.IsSmi()) overwrite_mode_ = NO_OVERWRITE; + if (type_info.IsSmi()) overwrite_mode_ = NO_OVERWRITE; set_comment("[ DeferredInlineSmiOperation"); } @@ -1780,7 +1780,7 @@ class DeferredInlineSmiOperation: public DeferredCode { Token::Value op_; Register dst_; Register src_; - NumberInfo number_info_; + TypeInfo type_info_; Smi* value_; OverwriteMode overwrite_mode_; }; @@ -1792,7 +1792,7 @@ void DeferredInlineSmiOperation::Generate() { op_, overwrite_mode_, (op_ == Token::MOD) ? NO_GENERIC_BINARY_FLAGS : NO_SMI_CODE_IN_STUB, - NumberInfo::Combine(NumberInfo::Smi(), number_info_)); + TypeInfo::Combine(TypeInfo::Smi(), type_info_)); stub.GenerateCall(masm_, src_, value_); if (!dst_.is(eax)) __ mov(dst_, eax); } @@ -1806,11 +1806,11 @@ class DeferredInlineSmiOperationReversed: public DeferredCode { Register dst, Smi* value, Register src, - NumberInfo number_info, + TypeInfo type_info, OverwriteMode overwrite_mode) : op_(op), dst_(dst), - number_info_(number_info), + type_info_(type_info), value_(value), src_(src), overwrite_mode_(overwrite_mode) { @@ -1822,7 +1822,7 @@ class DeferredInlineSmiOperationReversed: public DeferredCode { private: Token::Value op_; Register dst_; - NumberInfo number_info_; + TypeInfo type_info_; Smi* value_; Register src_; OverwriteMode overwrite_mode_; @@ -1834,7 +1834,7 @@ void DeferredInlineSmiOperationReversed::Generate() { op_, overwrite_mode_, NO_SMI_CODE_IN_STUB, - NumberInfo::Combine(NumberInfo::Smi(), number_info_)); + TypeInfo::Combine(TypeInfo::Smi(), type_info_)); igostub.GenerateCall(masm_, value_, src_); if (!dst_.is(eax)) __ mov(dst_, eax); } @@ -1846,14 +1846,14 @@ void DeferredInlineSmiOperationReversed::Generate() { class DeferredInlineSmiAdd: public DeferredCode { public: DeferredInlineSmiAdd(Register dst, - NumberInfo number_info, + TypeInfo type_info, Smi* value, OverwriteMode overwrite_mode) : dst_(dst), - number_info_(number_info), + type_info_(type_info), value_(value), overwrite_mode_(overwrite_mode) { - if (number_info_.IsSmi()) overwrite_mode_ = NO_OVERWRITE; + if (type_info_.IsSmi()) overwrite_mode_ = NO_OVERWRITE; set_comment("[ DeferredInlineSmiAdd"); } @@ -1861,7 +1861,7 @@ class DeferredInlineSmiAdd: public DeferredCode { private: Register dst_; - NumberInfo number_info_; + TypeInfo type_info_; Smi* value_; OverwriteMode overwrite_mode_; }; @@ -1874,7 +1874,7 @@ void DeferredInlineSmiAdd::Generate() { Token::ADD, overwrite_mode_, NO_SMI_CODE_IN_STUB, - NumberInfo::Combine(NumberInfo::Smi(), number_info_)); + TypeInfo::Combine(TypeInfo::Smi(), type_info_)); igostub.GenerateCall(masm_, dst_, value_); if (!dst_.is(eax)) __ mov(dst_, eax); } @@ -1886,11 +1886,11 @@ void DeferredInlineSmiAdd::Generate() { class DeferredInlineSmiAddReversed: public DeferredCode { public: DeferredInlineSmiAddReversed(Register dst, - NumberInfo number_info, + TypeInfo type_info, Smi* value, OverwriteMode overwrite_mode) : dst_(dst), - number_info_(number_info), + type_info_(type_info), value_(value), overwrite_mode_(overwrite_mode) { set_comment("[ DeferredInlineSmiAddReversed"); @@ -1900,7 +1900,7 @@ class DeferredInlineSmiAddReversed: public DeferredCode { private: Register dst_; - NumberInfo number_info_; + TypeInfo type_info_; Smi* value_; OverwriteMode overwrite_mode_; }; @@ -1913,7 +1913,7 @@ void DeferredInlineSmiAddReversed::Generate() { Token::ADD, overwrite_mode_, NO_SMI_CODE_IN_STUB, - NumberInfo::Combine(NumberInfo::Smi(), number_info_)); + TypeInfo::Combine(TypeInfo::Smi(), type_info_)); igostub.GenerateCall(masm_, value_, dst_); if (!dst_.is(eax)) __ mov(dst_, eax); } @@ -1926,14 +1926,14 @@ void DeferredInlineSmiAddReversed::Generate() { class DeferredInlineSmiSub: public DeferredCode { public: DeferredInlineSmiSub(Register dst, - NumberInfo number_info, + TypeInfo type_info, Smi* value, OverwriteMode overwrite_mode) : dst_(dst), - number_info_(number_info), + type_info_(type_info), value_(value), overwrite_mode_(overwrite_mode) { - if (number_info.IsSmi()) overwrite_mode_ = NO_OVERWRITE; + if (type_info.IsSmi()) overwrite_mode_ = NO_OVERWRITE; set_comment("[ DeferredInlineSmiSub"); } @@ -1941,7 +1941,7 @@ class DeferredInlineSmiSub: public DeferredCode { private: Register dst_; - NumberInfo number_info_; + TypeInfo type_info_; Smi* value_; OverwriteMode overwrite_mode_; }; @@ -1954,7 +1954,7 @@ void DeferredInlineSmiSub::Generate() { Token::SUB, overwrite_mode_, NO_SMI_CODE_IN_STUB, - NumberInfo::Combine(NumberInfo::Smi(), number_info_)); + TypeInfo::Combine(TypeInfo::Smi(), type_info_)); igostub.GenerateCall(masm_, dst_, value_); if (!dst_.is(eax)) __ mov(dst_, eax); } @@ -1999,18 +1999,18 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, DeferredCode* deferred = NULL; if (reversed) { deferred = new DeferredInlineSmiAddReversed(operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); } else { deferred = new DeferredInlineSmiAdd(operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); } __ add(Operand(operand->reg()), Immediate(value)); deferred->Branch(overflow); - if (!operand->number_info().IsSmi()) { + if (!operand->type_info().IsSmi()) { __ test(operand->reg(), Immediate(kSmiTagMask)); deferred->Branch(not_zero); } else { @@ -2035,7 +2035,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, answer.reg(), smi_value, operand->reg(), - operand->number_info(), + operand->type_info(), overwrite_mode); __ sub(answer.reg(), Operand(operand->reg())); } else { @@ -2043,13 +2043,13 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, frame_->Spill(operand->reg()); answer = *operand; deferred = new DeferredInlineSmiSub(operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); __ sub(Operand(operand->reg()), Immediate(value)); } deferred->Branch(overflow); - if (!operand->number_info().IsSmi()) { + if (!operand->type_info().IsSmi()) { __ test(answer.reg(), Immediate(kSmiTagMask)); deferred->Branch(not_zero); } else { @@ -2071,12 +2071,12 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, int shift_value = int_value & 0x1f; operand->ToRegister(); frame_->Spill(operand->reg()); - if (!operand->number_info().IsSmi()) { + if (!operand->type_info().IsSmi()) { DeferredInlineSmiOperation* deferred = new DeferredInlineSmiOperation(op, operand->reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); __ test(operand->reg(), Immediate(kSmiTagMask)); @@ -2113,10 +2113,10 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, new DeferredInlineSmiOperation(op, answer.reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); - if (!operand->number_info().IsSmi()) { + if (!operand->type_info().IsSmi()) { __ test(operand->reg(), Immediate(kSmiTagMask)); deferred->Branch(not_zero); } else { @@ -2163,11 +2163,11 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, answer.reg(), smi_value, right.reg(), - right.number_info(), + right.type_info(), overwrite_mode); __ mov(answer.reg(), Immediate(int_value)); __ sar(ecx, kSmiTagSize); - if (!right.number_info().IsSmi()) { + if (!right.type_info().IsSmi()) { deferred->Branch(carry); } else { if (FLAG_debug_code) __ AbortIfNotSmi(right.reg()); @@ -2190,7 +2190,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, new DeferredInlineSmiOperation(op, operand->reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); __ test(operand->reg(), Immediate(kSmiTagMask)); @@ -2205,10 +2205,10 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, new DeferredInlineSmiOperation(op, answer.reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); - if (!operand->number_info().IsSmi()) { + if (!operand->type_info().IsSmi()) { __ test(operand->reg(), Immediate(kSmiTagMask)); deferred->Branch(not_zero); } else { @@ -2242,17 +2242,17 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, operand->reg(), smi_value, operand->reg(), - operand->number_info(), + operand->type_info(), overwrite_mode); } else { deferred = new DeferredInlineSmiOperation(op, operand->reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); } - if (!operand->number_info().IsSmi()) { + if (!operand->type_info().IsSmi()) { __ test(operand->reg(), Immediate(kSmiTagMask)); deferred->Branch(not_zero); } else { @@ -2284,7 +2284,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, new DeferredInlineSmiOperation(op, operand->reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); // Check that lowest log2(value) bits of operand are zero, and test @@ -2320,7 +2320,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, new DeferredInlineSmiOperation(op, operand->reg(), operand->reg(), - operand->number_info(), + operand->type_info(), smi_value, overwrite_mode); // Check for negative or non-Smi left hand side. @@ -2356,8 +2356,8 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, static bool CouldBeNaN(const Result& result) { - if (result.number_info().IsSmi()) return false; - if (result.number_info().IsInteger32()) return false; + if (result.type_info().IsSmi()) return false; + if (result.type_info().IsInteger32()) return false; if (!result.is_constant()) return true; if (!result.handle()->IsHeapNumber()) return false; return isnan(HeapNumber::cast(*result.handle())->value()); @@ -3851,7 +3851,7 @@ void CodeGenerator::VisitWhileStatement(WhileStatement* node) { } -void CodeGenerator::SetTypeForStackSlot(Slot* slot, NumberInfo info) { +void CodeGenerator::SetTypeForStackSlot(Slot* slot, TypeInfo info) { ASSERT(slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER); if (slot->type() == Slot::LOCAL) { frame_->SetTypeForLocalAt(slot->index(), info); @@ -3971,7 +3971,7 @@ void CodeGenerator::VisitForStatement(ForStatement* node) { // the bottom check of the loop condition. if (node->is_fast_smi_loop()) { // Set number type of the loop variable to smi. - SetTypeForStackSlot(node->loop_variable()->slot(), NumberInfo::Smi()); + SetTypeForStackSlot(node->loop_variable()->slot(), TypeInfo::Smi()); } Visit(node->body()); @@ -3997,7 +3997,7 @@ void CodeGenerator::VisitForStatement(ForStatement* node) { // expression if we are in a fast smi loop condition. if (node->is_fast_smi_loop() && has_valid_frame()) { // Set number type of the loop variable to smi. - SetTypeForStackSlot(node->loop_variable()->slot(), NumberInfo::Smi()); + SetTypeForStackSlot(node->loop_variable()->slot(), TypeInfo::Smi()); } // Based on the condition analysis, compile the backward jump as @@ -6900,7 +6900,7 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { GenericUnaryOpStub stub(Token::SUB, overwrite); Result operand = frame_->Pop(); Result answer = frame_->CallStub(&stub, &operand); - answer.set_number_info(NumberInfo::Number()); + answer.set_type_info(TypeInfo::Number()); frame_->Push(&answer); break; } @@ -6909,7 +6909,7 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { JumpTarget smi_label; JumpTarget continue_label; Result operand = frame_->Pop(); - NumberInfo operand_info = operand.number_info(); + TypeInfo operand_info = operand.type_info(); operand.ToRegister(); if (operand_info.IsSmi()) { if (FLAG_debug_code) __ AbortIfNotSmi(operand.reg()); @@ -6918,7 +6918,7 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { __ lea(operand.reg(), Operand(operand.reg(), kSmiTagMask)); __ not_(operand.reg()); Result answer = operand; - answer.set_number_info(NumberInfo::Smi()); + answer.set_type_info(TypeInfo::Smi()); frame_->Push(&answer); } else { __ test(operand.reg(), Immediate(kSmiTagMask)); @@ -6937,9 +6937,9 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { continue_label.Bind(&answer); if (operand_info.IsInteger32()) { - answer.set_number_info(NumberInfo::Integer32()); + answer.set_type_info(TypeInfo::Integer32()); } else { - answer.set_number_info(NumberInfo::Number()); + answer.set_type_info(TypeInfo::Number()); } frame_->Push(&answer); } @@ -6949,7 +6949,7 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { // Smi check. JumpTarget continue_label; Result operand = frame_->Pop(); - NumberInfo operand_info = operand.number_info(); + TypeInfo operand_info = operand.type_info(); operand.ToRegister(); __ test(operand.reg(), Immediate(kSmiTagMask)); continue_label.Branch(zero, &operand, taken); @@ -6960,11 +6960,11 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { continue_label.Bind(&answer); if (operand_info.IsSmi()) { - answer.set_number_info(NumberInfo::Smi()); + answer.set_type_info(TypeInfo::Smi()); } else if (operand_info.IsInteger32()) { - answer.set_number_info(NumberInfo::Integer32()); + answer.set_type_info(TypeInfo::Integer32()); } else { - answer.set_number_info(NumberInfo::Number()); + answer.set_type_info(TypeInfo::Number()); } frame_->Push(&answer); break; @@ -7104,7 +7104,7 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) { // The return value for postfix operations is the // same as the input, and has the same number info. - old_value.set_number_info(new_value.number_info()); + old_value.set_type_info(new_value.type_info()); } // Ensure the new value is writable. @@ -7171,9 +7171,9 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) { // The result of ++ or -- is an Integer32 if the // input is a smi. Otherwise it is a number. if (new_value.is_smi()) { - new_value.set_number_info(NumberInfo::Integer32()); + new_value.set_type_info(TypeInfo::Integer32()); } else { - new_value.set_number_info(NumberInfo::Number()); + new_value.set_type_info(TypeInfo::Number()); } // Postfix: store the old value in the allocated slot under the @@ -7387,14 +7387,14 @@ void CodeGenerator::Int32BinaryOperation(BinaryOperation* node) { unsafe_bailout_->Branch(negative); __ bind(¬_negative_zero); } - Result edx_result(edx, NumberInfo::Integer32()); + Result edx_result(edx, TypeInfo::Integer32()); edx_result.set_untagged_int32(true); frame_->Push(&edx_result); } else { ASSERT(op == Token::DIV); __ test(edx, Operand(edx)); unsafe_bailout_->Branch(not_equal); - Result eax_result(eax, NumberInfo::Integer32()); + Result eax_result(eax, TypeInfo::Integer32()); eax_result.set_untagged_int32(true); frame_->Push(&eax_result); } @@ -8281,7 +8281,7 @@ Result CodeGenerator::EmitKeyedStore(StaticType* key_type) { static void CheckTwoForSminess(MacroAssembler* masm, Register left, Register right, Register scratch, - NumberInfo left_info, NumberInfo right_info, + TypeInfo left_info, TypeInfo right_info, DeferredInlineBinaryOperation* deferred) { if (left.is(right)) { if (!left_info.IsSmi()) { @@ -9782,14 +9782,14 @@ void TranscendentalCacheStub::GenerateOperation(MacroAssembler* masm) { // trashed registers. void IntegerConvert(MacroAssembler* masm, Register source, - NumberInfo number_info, + TypeInfo type_info, bool use_sse3, Label* conversion_failure) { ASSERT(!source.is(ecx) && !source.is(edi) && !source.is(ebx)); Label done, right_exponent, normal_exponent; Register scratch = ebx; Register scratch2 = edi; - if (!number_info.IsInteger32() || !use_sse3) { + if (!type_info.IsInteger32() || !use_sse3) { // Get exponent word. __ mov(scratch, FieldOperand(source, HeapNumber::kExponentOffset)); // Get exponent alone in scratch2. @@ -9798,7 +9798,7 @@ void IntegerConvert(MacroAssembler* masm, } if (use_sse3) { CpuFeatures::Scope scope(SSE3); - if (!number_info.IsInteger32()) { + if (!type_info.IsInteger32()) { // Check whether the exponent is too big for a 64 bit signed integer. static const uint32_t kTooBigExponent = (HeapNumber::kExponentBias + 63) << HeapNumber::kExponentShift; @@ -9919,7 +9919,7 @@ void IntegerConvert(MacroAssembler* masm, // Input: edx, eax are the left and right objects of a bit op. // Output: eax, ecx are left and right integers for a bit op. void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm, - NumberInfo number_info, + TypeInfo type_info, bool use_sse3, Label* conversion_failure) { // Check float operands. @@ -9927,8 +9927,8 @@ void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm, Label arg2_is_object, check_undefined_arg2; Label load_arg2, done; - if (!number_info.IsDouble()) { - if (!number_info.IsSmi()) { + if (!type_info.IsDouble()) { + if (!type_info.IsSmi()) { __ test(edx, Immediate(kSmiTagMask)); __ j(not_zero, &arg1_is_object); } else { @@ -9941,14 +9941,14 @@ void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm, __ bind(&arg1_is_object); // Get the untagged integer version of the edx heap number in ecx. - IntegerConvert(masm, edx, number_info, use_sse3, conversion_failure); + IntegerConvert(masm, edx, type_info, use_sse3, conversion_failure); __ mov(edx, ecx); // Here edx has the untagged integer, eax has a Smi or a heap number. __ bind(&load_arg2); - if (!number_info.IsDouble()) { + if (!type_info.IsDouble()) { // Test if arg2 is a Smi. - if (!number_info.IsSmi()) { + if (!type_info.IsSmi()) { __ test(eax, Immediate(kSmiTagMask)); __ j(not_zero, &arg2_is_object); } else { @@ -9962,7 +9962,7 @@ void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm, __ bind(&arg2_is_object); // Get the untagged integer version of the eax heap number in ecx. - IntegerConvert(masm, eax, number_info, use_sse3, conversion_failure); + IntegerConvert(masm, eax, type_info, use_sse3, conversion_failure); __ bind(&done); __ mov(eax, edx); } @@ -10000,7 +10000,7 @@ void FloatingPointHelper::LoadUnknownsAsIntegers(MacroAssembler* masm, // Get the untagged integer version of the edx heap number in ecx. IntegerConvert(masm, edx, - NumberInfo::Unknown(), + TypeInfo::Unknown(), use_sse3, conversion_failure); __ mov(edx, ecx); @@ -10031,7 +10031,7 @@ void FloatingPointHelper::LoadUnknownsAsIntegers(MacroAssembler* masm, // Get the untagged integer version of the eax heap number in ecx. IntegerConvert(masm, eax, - NumberInfo::Unknown(), + TypeInfo::Unknown(), use_sse3, conversion_failure); __ bind(&done); @@ -10040,11 +10040,11 @@ void FloatingPointHelper::LoadUnknownsAsIntegers(MacroAssembler* masm, void FloatingPointHelper::LoadAsIntegers(MacroAssembler* masm, - NumberInfo number_info, + TypeInfo type_info, bool use_sse3, Label* conversion_failure) { - if (number_info.IsNumber()) { - LoadNumbersAsIntegers(masm, number_info, use_sse3, conversion_failure); + if (type_info.IsNumber()) { + LoadNumbersAsIntegers(masm, type_info, use_sse3, conversion_failure); } else { LoadUnknownsAsIntegers(masm, use_sse3, conversion_failure); } @@ -10289,7 +10289,7 @@ void GenericUnaryOpStub::Generate(MacroAssembler* masm) { // Convert the heap number in eax to an untagged integer in ecx. IntegerConvert(masm, eax, - NumberInfo::Unknown(), + TypeInfo::Unknown(), CpuFeatures::IsSupported(SSE3), &slow); diff --git a/src/ia32/codegen-ia32.h b/src/ia32/codegen-ia32.h index e661a41c0..c4a077701 100644 --- a/src/ia32/codegen-ia32.h +++ b/src/ia32/codegen-ia32.h @@ -656,7 +656,7 @@ class CodeGenerator: public AstVisitor { void CodeForDoWhileConditionPosition(DoWhileStatement* stmt); void CodeForSourcePosition(int pos); - void SetTypeForStackSlot(Slot* slot, NumberInfo info); + void SetTypeForStackSlot(Slot* slot, TypeInfo info); #ifdef DEBUG // True if the registers are valid for entry to a block. There should @@ -740,7 +740,7 @@ class GenericBinaryOpStub: public CodeStub { GenericBinaryOpStub(Token::Value op, OverwriteMode mode, GenericBinaryFlags flags, - NumberInfo operands_type) + TypeInfo operands_type) : op_(op), mode_(mode), flags_(flags), @@ -763,7 +763,7 @@ class GenericBinaryOpStub: public CodeStub { args_in_registers_(ArgsInRegistersBits::decode(key)), args_reversed_(ArgsReversedBits::decode(key)), use_sse3_(SSE3Bits::decode(key)), - static_operands_type_(NumberInfo::ExpandedRepresentation( + static_operands_type_(TypeInfo::ExpandedRepresentation( StaticTypeInfoBits::decode(key))), runtime_operands_type_(runtime_operands_type), name_(NULL) { @@ -790,7 +790,7 @@ class GenericBinaryOpStub: public CodeStub { bool use_sse3_; // Number type information of operands, determined by code generator. - NumberInfo static_operands_type_; + TypeInfo static_operands_type_; // Operand type information determined at runtime. BinaryOpIC::TypeInfo runtime_operands_type_; @@ -802,7 +802,7 @@ class GenericBinaryOpStub: public CodeStub { #ifdef DEBUG void Print() { PrintF("GenericBinaryOpStub %d (op %s), " - "(mode %d, flags %d, registers %d, reversed %d, number_info %s)\n", + "(mode %d, flags %d, registers %d, reversed %d, type_info %s)\n", MinorKey(), Token::String(op_), static_cast(mode_), diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 3cc56e177..e59dc512d 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -1130,7 +1130,7 @@ void FullCodeGenerator::EmitBinaryOp(Token::Value op, GenericBinaryOpStub stub(op, NO_OVERWRITE, NO_GENERIC_BINARY_FLAGS, - NumberInfo::Unknown()); + TypeInfo::Unknown()); __ CallStub(&stub); Apply(context, eax); } @@ -1745,7 +1745,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { GenericBinaryOpStub stub(expr->binary_op(), NO_OVERWRITE, NO_GENERIC_BINARY_FLAGS, - NumberInfo::Unknown()); + TypeInfo::Unknown()); stub.GenerateCall(masm(), eax, Smi::FromInt(1)); __ bind(&done); diff --git a/src/ia32/register-allocator-ia32.cc b/src/ia32/register-allocator-ia32.cc index 0129314c8..73fefb3bb 100644 --- a/src/ia32/register-allocator-ia32.cc +++ b/src/ia32/register-allocator-ia32.cc @@ -75,7 +75,7 @@ void Result::ToRegister() { Immediate(handle())); } // This result becomes a copy of the fresh one. - fresh.set_number_info(number_info()); + fresh.set_type_info(type_info()); *this = fresh; } ASSERT(is_register()); @@ -122,7 +122,7 @@ void Result::ToRegister(Register target) { } } } - fresh.set_number_info(number_info()); + fresh.set_type_info(type_info()); fresh.set_untagged_int32(is_untagged_int32()); *this = fresh; } else if (is_register() && reg().is(target)) { diff --git a/src/ia32/virtual-frame-ia32.cc b/src/ia32/virtual-frame-ia32.cc index a8b0e8d2b..bc27e1de7 100644 --- a/src/ia32/virtual-frame-ia32.cc +++ b/src/ia32/virtual-frame-ia32.cc @@ -162,7 +162,7 @@ void VirtualFrame::MakeMergable() { if (element.is_constant() || element.is_copy()) { if (element.is_synced()) { // Just spill. - elements_[i] = FrameElement::MemoryElement(NumberInfo::Unknown()); + elements_[i] = FrameElement::MemoryElement(TypeInfo::Unknown()); } else { // Allocate to a register. FrameElement backing_element; // Invalid if not a copy. @@ -174,7 +174,7 @@ void VirtualFrame::MakeMergable() { elements_[i] = FrameElement::RegisterElement(fresh.reg(), FrameElement::NOT_SYNCED, - NumberInfo::Unknown()); + TypeInfo::Unknown()); Use(fresh.reg(), i); // Emit a move. @@ -207,7 +207,7 @@ void VirtualFrame::MakeMergable() { // The copy flag is not relied on before the end of this loop, // including when registers are spilled. elements_[i].clear_copied(); - elements_[i].set_number_info(NumberInfo::Unknown()); + elements_[i].set_type_info(TypeInfo::Unknown()); } } } @@ -597,12 +597,12 @@ int VirtualFrame::InvalidateFrameSlotAt(int index) { elements_[new_backing_index] = FrameElement::RegisterElement(backing_reg, FrameElement::SYNCED, - original.number_info()); + original.type_info()); } else { elements_[new_backing_index] = FrameElement::RegisterElement(backing_reg, FrameElement::NOT_SYNCED, - original.number_info()); + original.type_info()); } // Update the other copies. for (int i = new_backing_index + 1; i < element_count(); i++) { @@ -634,7 +634,7 @@ void VirtualFrame::TakeFrameSlotAt(int index) { FrameElement new_element = FrameElement::RegisterElement(fresh.reg(), FrameElement::NOT_SYNCED, - original.number_info()); + original.type_info()); Use(fresh.reg(), element_count()); elements_.Add(new_element); __ mov(fresh.reg(), Operand(ebp, fp_relative(index))); @@ -796,7 +796,7 @@ void VirtualFrame::UntaggedPushFrameSlotAt(int index) { FrameElement new_element = FrameElement::RegisterElement(fresh_reg, FrameElement::NOT_SYNCED, - original.number_info()); + original.type_info()); new_element.set_untagged_int32(true); Use(fresh_reg, element_count()); fresh.Unuse(); // BreakTarget does not handle a live Result well. @@ -808,7 +808,7 @@ void VirtualFrame::UntaggedPushFrameSlotAt(int index) { __ mov(fresh_reg, Operand(ebp, fp_relative(index))); } // Now convert the value to int32, or bail out. - if (original.number_info().IsSmi()) { + if (original.type_info().IsSmi()) { __ SmiUntag(fresh_reg); // Pushing the element is completely done. } else { @@ -819,7 +819,7 @@ void VirtualFrame::UntaggedPushFrameSlotAt(int index) { __ jmp(&done); __ bind(¬_smi); - if (!original.number_info().IsNumber()) { + if (!original.type_info().IsNumber()) { __ cmp(FieldOperand(fresh_reg, HeapObject::kMapOffset), Factory::heap_number_map()); cgen()->unsafe_bailout_->Branch(not_equal); @@ -1151,11 +1151,11 @@ Result VirtualFrame::Pop() { ASSERT(element.is_untagged_int32() == cgen()->in_safe_int32_mode()); // Get number type information of the result. - NumberInfo info; + TypeInfo info; if (!element.is_copy()) { - info = element.number_info(); + info = element.type_info(); } else { - info = elements_[element.index()].number_info(); + info = elements_[element.index()].type_info(); } bool pop_needed = (stack_pointer_ == index); @@ -1165,7 +1165,7 @@ Result VirtualFrame::Pop() { Result temp = cgen()->allocator()->Allocate(); ASSERT(temp.is_valid()); __ pop(temp.reg()); - temp.set_number_info(info); + temp.set_type_info(info); temp.set_untagged_int32(element.is_untagged_int32()); return temp; } @@ -1198,7 +1198,7 @@ Result VirtualFrame::Pop() { FrameElement new_element = FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED, - element.number_info()); + element.type_info()); // Preserve the copy flag on the element. if (element.is_copied()) new_element.set_copied(); elements_[index] = new_element; @@ -1233,7 +1233,7 @@ void VirtualFrame::EmitPop(Operand operand) { } -void VirtualFrame::EmitPush(Register reg, NumberInfo info) { +void VirtualFrame::EmitPush(Register reg, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; @@ -1241,7 +1241,7 @@ void VirtualFrame::EmitPush(Register reg, NumberInfo info) { } -void VirtualFrame::EmitPush(Operand operand, NumberInfo info) { +void VirtualFrame::EmitPush(Operand operand, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; @@ -1249,7 +1249,7 @@ void VirtualFrame::EmitPush(Operand operand, NumberInfo info) { } -void VirtualFrame::EmitPush(Immediate immediate, NumberInfo info) { +void VirtualFrame::EmitPush(Immediate immediate, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; diff --git a/src/ia32/virtual-frame-ia32.h b/src/ia32/virtual-frame-ia32.h index e622cdfe0..c179ba9ba 100644 --- a/src/ia32/virtual-frame-ia32.h +++ b/src/ia32/virtual-frame-ia32.h @@ -28,7 +28,7 @@ #ifndef V8_IA32_VIRTUAL_FRAME_IA32_H_ #define V8_IA32_VIRTUAL_FRAME_IA32_H_ -#include "number-info.h" +#include "type-info.h" #include "register-allocator.h" #include "scopes.h" @@ -84,7 +84,7 @@ class VirtualFrame: public ZoneObject { // Create a duplicate of an existing valid frame element. FrameElement CopyElementAt(int index, - NumberInfo info = NumberInfo::Uninitialized()); + TypeInfo info = TypeInfo::Uninitialized()); // The number of elements on the virtual frame. int element_count() { return elements_.length(); } @@ -398,14 +398,14 @@ class VirtualFrame: public ZoneObject { // Push an element on top of the expression stack and emit a // corresponding push instruction. void EmitPush(Register reg, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); void EmitPush(Operand operand, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); void EmitPush(Immediate immediate, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); // Push an element on the virtual frame. - inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown()); + inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown()); inline void Push(Handle value); inline void Push(Smi* value); @@ -417,7 +417,7 @@ class VirtualFrame: public ZoneObject { // This assert will trigger if you try to push the same value twice. ASSERT(result->is_valid()); if (result->is_register()) { - Push(result->reg(), result->number_info()); + Push(result->reg(), result->type_info()); } else { ASSERT(result->is_constant()); Push(result->handle()); @@ -447,8 +447,8 @@ class VirtualFrame: public ZoneObject { } // Update the type information of a variable frame element directly. - inline void SetTypeForLocalAt(int index, NumberInfo info); - inline void SetTypeForParamAt(int index, NumberInfo info); + inline void SetTypeForLocalAt(int index, TypeInfo info); + inline void SetTypeForParamAt(int index, TypeInfo info); private: static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; diff --git a/src/jump-target-inl.h b/src/jump-target-inl.h index 6db008153..2fcf410f5 100644 --- a/src/jump-target-inl.h +++ b/src/jump-target-inl.h @@ -46,7 +46,7 @@ void JumpTarget::InitializeEntryElement(int index, FrameElement* target) { entry_frame_->elements_[target->index()].set_copied(); } if (direction_ == BIDIRECTIONAL && !target->is_copy()) { - element->set_number_info(NumberInfo::Unknown()); + element->set_type_info(TypeInfo::Unknown()); } } diff --git a/src/jump-target.cc b/src/jump-target.cc index 8e949fba5..a78011769 100644 --- a/src/jump-target.cc +++ b/src/jump-target.cc @@ -107,8 +107,8 @@ void JumpTarget::ComputeEntryFrame() { // We overwrite the number information of one of the incoming frames. // This is safe because we only use the frame for emitting merge code. // The number information of incoming frames is not used anymore. - element->set_number_info(NumberInfo::Combine(element->number_info(), - other->number_info())); + element->set_type_info(TypeInfo::Combine(element->type_info(), + other->type_info())); } } elements[i] = element; @@ -135,7 +135,7 @@ void JumpTarget::ComputeEntryFrame() { FrameElement* target = elements[index]; if (target == NULL) { entry_frame_->elements_.Add( - FrameElement::MemoryElement(NumberInfo::Uninitialized())); + FrameElement::MemoryElement(TypeInfo::Uninitialized())); } else { entry_frame_->elements_.Add(*target); InitializeEntryElement(index, target); @@ -152,19 +152,19 @@ void JumpTarget::ComputeEntryFrame() { RegisterFile candidate_registers; int best_count = kMinInt; int best_reg_num = RegisterAllocator::kInvalidRegister; - NumberInfo info = NumberInfo::Uninitialized(); + TypeInfo info = TypeInfo::Uninitialized(); for (int j = 0; j < reaching_frames_.length(); j++) { FrameElement element = reaching_frames_[j]->elements_[i]; if (direction_ == BIDIRECTIONAL) { - info = NumberInfo::Unknown(); + info = TypeInfo::Unknown(); } else if (!element.is_copy()) { - info = NumberInfo::Combine(info, element.number_info()); + info = TypeInfo::Combine(info, element.type_info()); } else { // New elements will not be copies, so get number information from // backing element in the reaching frame. - info = NumberInfo::Combine(info, - reaching_frames_[j]->elements_[element.index()].number_info()); + info = TypeInfo::Combine(info, + reaching_frames_[j]->elements_[element.index()].type_info()); } is_synced = is_synced && element.is_synced(); if (element.is_register() && !entry_frame_->is_used(element.reg())) { @@ -189,7 +189,7 @@ void JumpTarget::ComputeEntryFrame() { if (is_synced) { // Already recorded as a memory element. // Set combined number info. - entry_frame_->elements_[i].set_number_info(info); + entry_frame_->elements_[i].set_type_info(info); continue; } @@ -211,12 +211,12 @@ void JumpTarget::ComputeEntryFrame() { Register reg = RegisterAllocator::ToRegister(best_reg_num); entry_frame_->elements_[i] = FrameElement::RegisterElement(reg, FrameElement::NOT_SYNCED, - NumberInfo::Uninitialized()); + TypeInfo::Uninitialized()); if (is_copied) entry_frame_->elements_[i].set_copied(); entry_frame_->set_register_location(reg, i); } // Set combined number info. - entry_frame_->elements_[i].set_number_info(info); + entry_frame_->elements_[i].set_type_info(info); } } @@ -225,7 +225,7 @@ void JumpTarget::ComputeEntryFrame() { if (direction_ == BIDIRECTIONAL) { for (int i = 0; i < length; ++i) { if (!entry_frame_->elements_[i].is_copy()) { - ASSERT(entry_frame_->elements_[i].number_info().IsUnknown()); + ASSERT(entry_frame_->elements_[i].type_info().IsUnknown()); } } } diff --git a/src/register-allocator-inl.h b/src/register-allocator-inl.h index 396c73f9f..e0ea9e189 100644 --- a/src/register-allocator-inl.h +++ b/src/register-allocator-inl.h @@ -104,36 +104,36 @@ void RegisterAllocator::Unuse(Register reg) { } -NumberInfo Result::number_info() const { +TypeInfo Result::type_info() const { ASSERT(is_valid()); - return NumberInfo::FromInt(NumberInfoField::decode(value_)); + return TypeInfo::FromInt(TypeInfoField::decode(value_)); } -void Result::set_number_info(NumberInfo info) { +void Result::set_type_info(TypeInfo info) { ASSERT(is_valid()); - value_ &= ~NumberInfoField::mask(); - value_ |= NumberInfoField::encode(info.ToInt()); + value_ &= ~TypeInfoField::mask(); + value_ |= TypeInfoField::encode(info.ToInt()); } bool Result::is_number() const { - return number_info().IsNumber(); + return type_info().IsNumber(); } bool Result::is_smi() const { - return number_info().IsSmi(); + return type_info().IsSmi(); } bool Result::is_integer32() const { - return number_info().IsInteger32(); + return type_info().IsInteger32(); } bool Result::is_double() const { - return number_info().IsDouble(); + return type_info().IsDouble(); } } } // namespace v8::internal diff --git a/src/register-allocator.cc b/src/register-allocator.cc index 64e442879..b9989a5dd 100644 --- a/src/register-allocator.cc +++ b/src/register-allocator.cc @@ -38,11 +38,11 @@ namespace internal { // Result implementation. -Result::Result(Register reg, NumberInfo info) { +Result::Result(Register reg, TypeInfo info) { ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg)); CodeGeneratorScope::Current()->allocator()->Use(reg); value_ = TypeField::encode(REGISTER) - | NumberInfoField::encode(info.ToInt()) + | TypeInfoField::encode(info.ToInt()) | DataField::encode(reg.code_); } diff --git a/src/register-allocator.h b/src/register-allocator.h index 5798fa2d1..0fbc83b82 100644 --- a/src/register-allocator.h +++ b/src/register-allocator.h @@ -29,7 +29,7 @@ #define V8_REGISTER_ALLOCATOR_H_ #include "macro-assembler.h" -#include "number-info-inl.h" +#include "type-info-inl.h" #if V8_TARGET_ARCH_IA32 #include "ia32/register-allocator-ia32.h" @@ -65,13 +65,13 @@ class Result BASE_EMBEDDED { Result() { invalidate(); } // Construct a register Result. - explicit Result(Register reg, NumberInfo info = NumberInfo::Unknown()); + explicit Result(Register reg, TypeInfo info = TypeInfo::Unknown()); // Construct a Result whose value is a compile-time constant. explicit Result(Handle value) { - NumberInfo info = NumberInfo::TypeFromValue(value); + TypeInfo info = TypeInfo::TypeFromValue(value); value_ = TypeField::encode(CONSTANT) - | NumberInfoField::encode(info.ToInt()) + | TypeInfoField::encode(info.ToInt()) | IsUntaggedInt32Field::encode(false) | DataField::encode(ConstantList()->length()); ConstantList()->Add(value); @@ -103,8 +103,8 @@ class Result BASE_EMBEDDED { void invalidate() { value_ = TypeField::encode(INVALID); } - inline NumberInfo number_info() const; - inline void set_number_info(NumberInfo info); + inline TypeInfo type_info() const; + inline void set_type_info(TypeInfo info); inline bool is_number() const; inline bool is_smi() const; inline bool is_integer32() const; @@ -155,7 +155,7 @@ class Result BASE_EMBEDDED { // Declare BitFields with template parameters . class TypeField: public BitField {}; - class NumberInfoField : public BitField {}; + class TypeInfoField : public BitField {}; class IsUntaggedInt32Field : public BitField {}; class DataField: public BitField {}; diff --git a/src/number-info-inl.h b/src/type-info-inl.h similarity index 81% rename from src/number-info-inl.h rename to src/type-info-inl.h index 0b5a44d73..90d3f55f9 100644 --- a/src/number-info-inl.h +++ b/src/type-info-inl.h @@ -25,26 +25,26 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef V8_NUMBER_INFO_INL_H_ -#define V8_NUMBER_INFO_INL_H_ +#ifndef V8_TYPE_INFO_INL_H_ +#define V8_TYPE_INFO_INL_H_ -#include "number-info.h" +#include "type-info.h" #include "objects-inl.h" namespace v8 { namespace internal { -NumberInfo NumberInfo::TypeFromValue(Handle value) { - NumberInfo info; +TypeInfo TypeInfo::TypeFromValue(Handle value) { + TypeInfo info; if (value->IsSmi()) { - info = NumberInfo::Smi(); + info = TypeInfo::Smi(); } else if (value->IsHeapNumber()) { - info = NumberInfo::IsInt32Double(HeapNumber::cast(*value)->value()) - ? NumberInfo::Integer32() - : NumberInfo::Double(); + info = TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value()) + ? TypeInfo::Integer32() + : TypeInfo::Double(); } else { - info = NumberInfo::Unknown(); + info = TypeInfo::Unknown(); } return info; } @@ -52,4 +52,4 @@ NumberInfo NumberInfo::TypeFromValue(Handle value) { } } // namespace v8::internal -#endif // V8_NUMBER_INFO_INL_H_ +#endif // V8_TYPE_INFO_INL_H_ diff --git a/src/number-info.h b/src/type-info.h similarity index 80% rename from src/number-info.h rename to src/type-info.h index 82b76bbcb..15bc12802 100644 --- a/src/number-info.h +++ b/src/type-info.h @@ -25,8 +25,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef V8_NUMBER_INFO_H_ -#define V8_NUMBER_INFO_H_ +#ifndef V8_TYPE_INFO_H_ +#define V8_TYPE_INFO_H_ #include "globals.h" @@ -45,25 +45,25 @@ namespace internal { // | / / // Uninitialized. -class NumberInfo { +class TypeInfo { public: - NumberInfo() { } + TypeInfo() { } - static inline NumberInfo Unknown(); + static inline TypeInfo Unknown(); // We know it's a primitive type. - static inline NumberInfo Primitive(); + static inline TypeInfo Primitive(); // We know it's a number of some sort. - static inline NumberInfo Number(); + static inline TypeInfo Number(); // We know it's signed or unsigned 32 bit integer. - static inline NumberInfo Integer32(); + static inline TypeInfo Integer32(); // We know it's a Smi. - static inline NumberInfo Smi(); + static inline TypeInfo Smi(); // We know it's a heap number. - static inline NumberInfo Double(); + static inline TypeInfo Double(); // We know it's a string. - static inline NumberInfo String(); + static inline TypeInfo String(); // We haven't started collecting info yet. - static inline NumberInfo Uninitialized(); + static inline TypeInfo Uninitialized(); // Return compact representation. Very sensitive to enum values below! // Compacting drops information about primtive types and strings types. @@ -78,7 +78,7 @@ class NumberInfo { } // Decode compact representation. Very sensitive to enum values below! - static NumberInfo ExpandedRepresentation(int three_bit_representation) { + static TypeInfo ExpandedRepresentation(int three_bit_representation) { Type t = static_cast(three_bit_representation >= 6 ? three_bit_representation + 2 : three_bit_representation); @@ -88,14 +88,14 @@ class NumberInfo { t == kInteger32Type || t == kSmiType || t == kDoubleType); - return NumberInfo(t); + return TypeInfo(t); } int ToInt() { return type_; } - static NumberInfo FromInt(int bit_representation) { + static TypeInfo FromInt(int bit_representation) { Type t = static_cast(bit_representation); ASSERT(t == kUnknownType || t == kPrimitiveType || @@ -104,12 +104,12 @@ class NumberInfo { t == kSmiType || t == kDoubleType || t == kStringType); - return NumberInfo(t); + return TypeInfo(t); } // Return the weakest (least precise) common type. - static NumberInfo Combine(NumberInfo a, NumberInfo b) { - return NumberInfo(static_cast(a.type_ & b.type_)); + static TypeInfo Combine(TypeInfo a, TypeInfo b) { + return TypeInfo(static_cast(a.type_ & b.type_)); } @@ -130,7 +130,7 @@ class NumberInfo { return false; } - static inline NumberInfo TypeFromValue(Handle value); + static inline TypeInfo TypeFromValue(Handle value); inline bool IsUnknown() { return type_ == kUnknownType; @@ -189,51 +189,51 @@ class NumberInfo { kStringType = 0x30, // 110000 kUninitializedType = 0x3f // 111111 }; - explicit inline NumberInfo(Type t) : type_(t) { } + explicit inline TypeInfo(Type t) : type_(t) { } Type type_; }; -NumberInfo NumberInfo::Unknown() { - return NumberInfo(kUnknownType); +TypeInfo TypeInfo::Unknown() { + return TypeInfo(kUnknownType); } -NumberInfo NumberInfo::Primitive() { - return NumberInfo(kPrimitiveType); +TypeInfo TypeInfo::Primitive() { + return TypeInfo(kPrimitiveType); } -NumberInfo NumberInfo::Number() { - return NumberInfo(kNumberType); +TypeInfo TypeInfo::Number() { + return TypeInfo(kNumberType); } -NumberInfo NumberInfo::Integer32() { - return NumberInfo(kInteger32Type); +TypeInfo TypeInfo::Integer32() { + return TypeInfo(kInteger32Type); } -NumberInfo NumberInfo::Smi() { - return NumberInfo(kSmiType); +TypeInfo TypeInfo::Smi() { + return TypeInfo(kSmiType); } -NumberInfo NumberInfo::Double() { - return NumberInfo(kDoubleType); +TypeInfo TypeInfo::Double() { + return TypeInfo(kDoubleType); } -NumberInfo NumberInfo::String() { - return NumberInfo(kStringType); +TypeInfo TypeInfo::String() { + return TypeInfo(kStringType); } -NumberInfo NumberInfo::Uninitialized() { - return NumberInfo(kUninitializedType); +TypeInfo TypeInfo::Uninitialized() { + return TypeInfo(kUninitializedType); } } } // namespace v8::internal -#endif // V8_NUMBER_INFO_H_ +#endif // V8_TYPE_INFO_H_ diff --git a/src/virtual-frame-inl.h b/src/virtual-frame-inl.h index 4050d715b..95a587ec0 100644 --- a/src/virtual-frame-inl.h +++ b/src/virtual-frame-inl.h @@ -40,7 +40,7 @@ VirtualFrame::VirtualFrame() : elements_(parameter_count() + local_count() + kPreallocatedElements), stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. for (int i = 0; i <= stack_pointer_; i++) { - elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); + elements_.Add(FrameElement::MemoryElement(TypeInfo::Unknown())); } for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { register_locations_[i] = kIllegalIndex; @@ -65,7 +65,7 @@ void VirtualFrame::PushFrameSlotAt(int index) { } -void VirtualFrame::Push(Register reg, NumberInfo info) { +void VirtualFrame::Push(Register reg, TypeInfo info) { if (is_used(reg)) { int index = register_location(reg); FrameElement element = CopyElementAt(index, info); @@ -120,13 +120,13 @@ bool VirtualFrame::Equals(VirtualFrame* other) { } -void VirtualFrame::SetTypeForLocalAt(int index, NumberInfo info) { - elements_[local0_index() + index].set_number_info(info); +void VirtualFrame::SetTypeForLocalAt(int index, TypeInfo info) { + elements_[local0_index() + index].set_type_info(info); } -void VirtualFrame::SetTypeForParamAt(int index, NumberInfo info) { - elements_[param0_index() + index].set_number_info(info); +void VirtualFrame::SetTypeForParamAt(int index, TypeInfo info) { + elements_[param0_index() + index].set_type_info(info); } diff --git a/src/virtual-frame.cc b/src/virtual-frame.cc index 070424cf4..af5ff3371 100644 --- a/src/virtual-frame.cc +++ b/src/virtual-frame.cc @@ -43,7 +43,7 @@ namespace internal { // not conflict with the existing type information and must be equally or // more precise. The default parameter value kUninitialized means that there // is no additional information. -FrameElement VirtualFrame::CopyElementAt(int index, NumberInfo info) { +FrameElement VirtualFrame::CopyElementAt(int index, TypeInfo info) { ASSERT(index >= 0); ASSERT(index < element_count()); @@ -74,14 +74,14 @@ FrameElement VirtualFrame::CopyElementAt(int index, NumberInfo info) { result.set_index(index); elements_[index].set_copied(); // Update backing element's number information. - NumberInfo existing = elements_[index].number_info(); + TypeInfo existing = elements_[index].type_info(); ASSERT(!existing.IsUninitialized()); // Assert that the new type information (a) does not conflict with the // existing one and (b) is equally or more precise. ASSERT((info.ToInt() & existing.ToInt()) == existing.ToInt()); ASSERT((info.ToInt() | existing.ToInt()) == info.ToInt()); - elements_[index].set_number_info(!info.IsUninitialized() + elements_[index].set_type_info(!info.IsUninitialized() ? info : existing); break; @@ -104,7 +104,7 @@ void VirtualFrame::Adjust(int count) { ASSERT(stack_pointer_ == element_count() - 1); for (int i = 0; i < count; i++) { - elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); + elements_.Add(FrameElement::MemoryElement(TypeInfo::Unknown())); } stack_pointer_ += count; } @@ -152,11 +152,11 @@ void VirtualFrame::SpillElementAt(int index) { SyncElementAt(index); // Number type information is preserved. // Copies get their number information from their backing element. - NumberInfo info; + TypeInfo info; if (!elements_[index].is_copy()) { - info = elements_[index].number_info(); + info = elements_[index].type_info(); } else { - info = elements_[elements_[index].index()].number_info(); + info = elements_[elements_[index].index()].type_info(); } // The element is now in memory. Its copied flag is preserved. FrameElement new_element = FrameElement::MemoryElement(info); @@ -318,7 +318,7 @@ void VirtualFrame::SetElementAt(int index, Result* value) { elements_[frame_index] = FrameElement::RegisterElement(value->reg(), FrameElement::NOT_SYNCED, - value->number_info()); + value->type_info()); } } else { ASSERT(value->is_constant()); diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc index 2f873c54b..108384cf1 100644 --- a/src/x64/codegen-x64.cc +++ b/src/x64/codegen-x64.cc @@ -4368,7 +4368,7 @@ void CodeGenerator::ToBoolean(ControlDestination* dest) { if (value.is_number()) { Comment cmnt(masm_, "ONLY_NUMBER"); - // Fast case if NumberInfo indicates only numbers. + // Fast case if TypeInfo indicates only numbers. if (FLAG_debug_code) { __ AbortIfNotNumber(value.reg(), "ToBoolean operand is not a number."); } @@ -5291,8 +5291,8 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op, } // Get number type of left and right sub-expressions. - NumberInfo operands_type = - NumberInfo::Combine(left.number_info(), right.number_info()); + TypeInfo operands_type = + TypeInfo::Combine(left.type_info(), right.type_info()); Result answer; if (left_is_non_smi_constant || right_is_non_smi_constant) { @@ -5324,13 +5324,13 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op, } } - // Set NumberInfo of result according to the operation performed. + // Set TypeInfo of result according to the operation performed. // We rely on the fact that smis have a 32 bit payload on x64. ASSERT(kSmiValueSize == 32); - NumberInfo result_type = NumberInfo::Unknown(); + TypeInfo result_type = TypeInfo::Unknown(); switch (op) { case Token::COMMA: - result_type = right.number_info(); + result_type = right.type_info(); break; case Token::OR: case Token::AND: @@ -5341,37 +5341,37 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op, case Token::BIT_XOR: case Token::BIT_AND: // Result is always a smi. - result_type = NumberInfo::Smi(); + result_type = TypeInfo::Smi(); break; case Token::SAR: case Token::SHL: // Result is always a smi. - result_type = NumberInfo::Smi(); + result_type = TypeInfo::Smi(); break; case Token::SHR: // Result of x >>> y is always a smi if y >= 1, otherwise a number. result_type = (right.is_constant() && right.handle()->IsSmi() && Smi::cast(*right.handle())->value() >= 1) - ? NumberInfo::Smi() - : NumberInfo::Number(); + ? TypeInfo::Smi() + : TypeInfo::Number(); break; case Token::ADD: // Result could be a string or a number. Check types of inputs. result_type = operands_type.IsNumber() - ? NumberInfo::Number() - : NumberInfo::Unknown(); + ? TypeInfo::Number() + : TypeInfo::Unknown(); break; case Token::SUB: case Token::MUL: case Token::DIV: case Token::MOD: // Result is always a number. - result_type = NumberInfo::Number(); + result_type = TypeInfo::Number(); break; default: UNREACHABLE(); } - answer.set_number_info(result_type); + answer.set_type_info(result_type); frame_->Push(&answer); } diff --git a/src/x64/codegen-x64.h b/src/x64/codegen-x64.h index a43856f6f..3f339181b 100644 --- a/src/x64/codegen-x64.h +++ b/src/x64/codegen-x64.h @@ -667,7 +667,7 @@ class GenericBinaryOpStub: public CodeStub { GenericBinaryOpStub(Token::Value op, OverwriteMode mode, GenericBinaryFlags flags, - NumberInfo operands_type = NumberInfo::Unknown()) + TypeInfo operands_type = TypeInfo::Unknown()) : op_(op), mode_(mode), flags_(flags), @@ -687,7 +687,7 @@ class GenericBinaryOpStub: public CodeStub { args_in_registers_(ArgsInRegistersBits::decode(key)), args_reversed_(ArgsReversedBits::decode(key)), use_sse3_(SSE3Bits::decode(key)), - static_operands_type_(NumberInfo::ExpandedRepresentation( + static_operands_type_(TypeInfo::ExpandedRepresentation( StaticTypeInfoBits::decode(key))), runtime_operands_type_(type_info), name_(NULL) { @@ -714,7 +714,7 @@ class GenericBinaryOpStub: public CodeStub { bool use_sse3_; // Number type information of operands, determined by code generator. - NumberInfo static_operands_type_; + TypeInfo static_operands_type_; // Operand type information determined at runtime. BinaryOpIC::TypeInfo runtime_operands_type_; diff --git a/src/x64/register-allocator-x64.cc b/src/x64/register-allocator-x64.cc index 9dc97b845..cf295935b 100644 --- a/src/x64/register-allocator-x64.cc +++ b/src/x64/register-allocator-x64.cc @@ -44,7 +44,7 @@ void Result::ToRegister() { ASSERT(fresh.is_valid()); CodeGeneratorScope::Current()->masm()->Move(fresh.reg(), handle()); // This result becomes a copy of the fresh one. - fresh.set_number_info(number_info()); + fresh.set_type_info(type_info()); *this = fresh; } ASSERT(is_register()); @@ -62,7 +62,7 @@ void Result::ToRegister(Register target) { ASSERT(is_constant()); CodeGeneratorScope::Current()->masm()->Move(fresh.reg(), handle()); } - fresh.set_number_info(number_info()); + fresh.set_type_info(type_info()); *this = fresh; } else if (is_register() && reg().is(target)) { ASSERT(CodeGeneratorScope::Current()->has_valid_frame()); diff --git a/src/x64/virtual-frame-x64.cc b/src/x64/virtual-frame-x64.cc index ca1042334..fa04b632f 100644 --- a/src/x64/virtual-frame-x64.cc +++ b/src/x64/virtual-frame-x64.cc @@ -177,7 +177,7 @@ void VirtualFrame::EmitPop(const Operand& operand) { } -void VirtualFrame::EmitPush(Register reg, NumberInfo info) { +void VirtualFrame::EmitPush(Register reg, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; @@ -185,7 +185,7 @@ void VirtualFrame::EmitPush(Register reg, NumberInfo info) { } -void VirtualFrame::EmitPush(const Operand& operand, NumberInfo info) { +void VirtualFrame::EmitPush(const Operand& operand, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; @@ -193,7 +193,7 @@ void VirtualFrame::EmitPush(const Operand& operand, NumberInfo info) { } -void VirtualFrame::EmitPush(Immediate immediate, NumberInfo info) { +void VirtualFrame::EmitPush(Immediate immediate, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; @@ -203,7 +203,7 @@ void VirtualFrame::EmitPush(Immediate immediate, NumberInfo info) { void VirtualFrame::EmitPush(Smi* smi_value) { ASSERT(stack_pointer_ == element_count() - 1); - elements_.Add(FrameElement::MemoryElement(NumberInfo::Smi())); + elements_.Add(FrameElement::MemoryElement(TypeInfo::Smi())); stack_pointer_++; __ Push(smi_value); } @@ -211,14 +211,14 @@ void VirtualFrame::EmitPush(Smi* smi_value) { void VirtualFrame::EmitPush(Handle value) { ASSERT(stack_pointer_ == element_count() - 1); - NumberInfo info = NumberInfo::TypeFromValue(value); + TypeInfo info = TypeInfo::TypeFromValue(value); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; __ Push(value); } -void VirtualFrame::EmitPush(Heap::RootListIndex index, NumberInfo info) { +void VirtualFrame::EmitPush(Heap::RootListIndex index, TypeInfo info) { ASSERT(stack_pointer_ == element_count() - 1); elements_.Add(FrameElement::MemoryElement(info)); stack_pointer_++; @@ -292,12 +292,12 @@ int VirtualFrame::InvalidateFrameSlotAt(int index) { elements_[new_backing_index] = FrameElement::RegisterElement(backing_reg, FrameElement::SYNCED, - original.number_info()); + original.type_info()); } else { elements_[new_backing_index] = FrameElement::RegisterElement(backing_reg, FrameElement::NOT_SYNCED, - original.number_info()); + original.type_info()); } // Update the other copies. for (int i = new_backing_index + 1; i < element_count(); i++) { @@ -329,7 +329,7 @@ void VirtualFrame::TakeFrameSlotAt(int index) { FrameElement new_element = FrameElement::RegisterElement(fresh.reg(), FrameElement::NOT_SYNCED, - original.number_info()); + original.type_info()); Use(fresh.reg(), element_count()); elements_.Add(new_element); __ movq(fresh.reg(), Operand(rbp, fp_relative(index))); @@ -475,7 +475,7 @@ void VirtualFrame::MakeMergable() { if (element.is_constant() || element.is_copy()) { if (element.is_synced()) { // Just spill. - elements_[i] = FrameElement::MemoryElement(NumberInfo::Unknown()); + elements_[i] = FrameElement::MemoryElement(TypeInfo::Unknown()); } else { // Allocate to a register. FrameElement backing_element; // Invalid if not a copy. @@ -487,7 +487,7 @@ void VirtualFrame::MakeMergable() { elements_[i] = FrameElement::RegisterElement(fresh.reg(), FrameElement::NOT_SYNCED, - NumberInfo::Unknown()); + TypeInfo::Unknown()); Use(fresh.reg(), i); // Emit a move. @@ -516,7 +516,7 @@ void VirtualFrame::MakeMergable() { // The copy flag is not relied on before the end of this loop, // including when registers are spilled. elements_[i].clear_copied(); - elements_[i].set_number_info(NumberInfo::Unknown()); + elements_[i].set_type_info(TypeInfo::Unknown()); } } } @@ -723,11 +723,11 @@ Result VirtualFrame::Pop() { ASSERT(element.is_valid()); // Get number type information of the result. - NumberInfo info; + TypeInfo info; if (!element.is_copy()) { - info = element.number_info(); + info = element.type_info(); } else { - info = elements_[element.index()].number_info(); + info = elements_[element.index()].type_info(); } bool pop_needed = (stack_pointer_ == index); @@ -737,7 +737,7 @@ Result VirtualFrame::Pop() { Result temp = cgen()->allocator()->Allocate(); ASSERT(temp.is_valid()); __ pop(temp.reg()); - temp.set_number_info(info); + temp.set_type_info(info); return temp; } @@ -767,7 +767,7 @@ Result VirtualFrame::Pop() { FrameElement new_element = FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED, - element.number_info()); + element.type_info()); // Preserve the copy flag on the element. if (element.is_copied()) new_element.set_copied(); elements_[index] = new_element; diff --git a/src/x64/virtual-frame-x64.h b/src/x64/virtual-frame-x64.h index 3e9f6dd65..04dc142ae 100644 --- a/src/x64/virtual-frame-x64.h +++ b/src/x64/virtual-frame-x64.h @@ -28,7 +28,7 @@ #ifndef V8_X64_VIRTUAL_FRAME_X64_H_ #define V8_X64_VIRTUAL_FRAME_X64_H_ -#include "number-info.h" +#include "type-info.h" #include "register-allocator.h" #include "scopes.h" @@ -83,7 +83,7 @@ class VirtualFrame : public ZoneObject { // Create a duplicate of an existing valid frame element. FrameElement CopyElementAt(int index, - NumberInfo info = NumberInfo::Uninitialized()); + TypeInfo info = TypeInfo::Uninitialized()); // The number of elements on the virtual frame. int element_count() { return elements_.length(); } @@ -383,19 +383,19 @@ class VirtualFrame : public ZoneObject { // Push an element on top of the expression stack and emit a // corresponding push instruction. void EmitPush(Register reg, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); void EmitPush(const Operand& operand, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); void EmitPush(Heap::RootListIndex index, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); void EmitPush(Immediate immediate, - NumberInfo info = NumberInfo::Unknown()); + TypeInfo info = TypeInfo::Unknown()); void EmitPush(Smi* value); // Uses kScratchRegister, emits appropriate relocation info. void EmitPush(Handle value); // Push an element on the virtual frame. - inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown()); + inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown()); inline void Push(Handle value); inline void Push(Smi* value); @@ -403,7 +403,7 @@ class VirtualFrame : public ZoneObject { // frame). void Push(Result* result) { if (result->is_register()) { - Push(result->reg(), result->number_info()); + Push(result->reg(), result->type_info()); } else { ASSERT(result->is_constant()); Push(result->handle()); @@ -416,8 +416,8 @@ class VirtualFrame : public ZoneObject { // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). inline void Nip(int num_dropped); - inline void SetTypeForLocalAt(int index, NumberInfo info); - inline void SetTypeForParamAt(int index, NumberInfo info); + inline void SetTypeForLocalAt(int index, TypeInfo info); + inline void SetTypeForParamAt(int index, TypeInfo info); private: static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index 9517533b9..53a182fba 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -330,8 +330,6 @@ '../../src/messages.cc', '../../src/messages.h', '../../src/natives.h', - '../../src/number-info-inl.h', - '../../src/number-info.h', '../../src/objects-debug.cc', '../../src/objects-inl.h', '../../src/objects.cc', @@ -388,6 +386,8 @@ '../../src/token.h', '../../src/top.cc', '../../src/top.h', + '../../src/type-info-inl.h', + '../../src/type-info.h', '../../src/unicode-inl.h', '../../src/unicode.cc', '../../src/unicode.h', diff --git a/tools/visual_studio/v8_base.vcproj b/tools/visual_studio/v8_base.vcproj index 6ab09ef5a..f10876cdd 100644 --- a/tools/visual_studio/v8_base.vcproj +++ b/tools/visual_studio/v8_base.vcproj @@ -688,14 +688,6 @@ RelativePath="..\..\src\natives.h" > - - - - @@ -936,6 +928,14 @@ RelativePath="..\..\src\top.h" > + + + + diff --git a/tools/visual_studio/v8_base_arm.vcproj b/tools/visual_studio/v8_base_arm.vcproj index 34dfbd067..a114aaa33 100644 --- a/tools/visual_studio/v8_base_arm.vcproj +++ b/tools/visual_studio/v8_base_arm.vcproj @@ -668,14 +668,6 @@ RelativePath="..\..\src\natives.h" > - - - - @@ -924,6 +916,14 @@ RelativePath="..\..\src\top.h" > + + + + diff --git a/tools/visual_studio/v8_base_x64.vcproj b/tools/visual_studio/v8_base_x64.vcproj index 852fc8fc7..fa75ae4ea 100644 --- a/tools/visual_studio/v8_base_x64.vcproj +++ b/tools/visual_studio/v8_base_x64.vcproj @@ -665,14 +665,6 @@ RelativePath="..\..\src\natives.h" > - - - - @@ -913,6 +905,14 @@ RelativePath="..\..\src\top.h" > + + + + -- 2.34.1