| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 V(Sar) \ | 158 V(Sar) \ |
| 159 V(SeqStringGetChar) \ | 159 V(SeqStringGetChar) \ |
| 160 V(SeqStringSetChar) \ | 160 V(SeqStringSetChar) \ |
| 161 V(Shl) \ | 161 V(Shl) \ |
| 162 V(Shr) \ | 162 V(Shr) \ |
| 163 V(Simulate) \ | 163 V(Simulate) \ |
| 164 V(StackCheck) \ | 164 V(StackCheck) \ |
| 165 V(StoreCodeEntry) \ | 165 V(StoreCodeEntry) \ |
| 166 V(StoreContextSlot) \ | 166 V(StoreContextSlot) \ |
| 167 V(StoreGlobalCell) \ | 167 V(StoreGlobalCell) \ |
| 168 V(StoreGlobalGeneric) \ | |
| 169 V(StoreKeyed) \ | 168 V(StoreKeyed) \ |
| 170 V(StoreKeyedGeneric) \ | 169 V(StoreKeyedGeneric) \ |
| 171 V(StoreNamedField) \ | 170 V(StoreNamedField) \ |
| 172 V(StoreNamedGeneric) \ | 171 V(StoreNamedGeneric) \ |
| 173 V(StringAdd) \ | 172 V(StringAdd) \ |
| 174 V(StringCharCodeAt) \ | 173 V(StringCharCodeAt) \ |
| 175 V(StringCharFromCode) \ | 174 V(StringCharFromCode) \ |
| 176 V(StringCompareAndBranch) \ | 175 V(StringCompareAndBranch) \ |
| 177 V(Sub) \ | 176 V(Sub) \ |
| 178 V(ThisFunction) \ | 177 V(ThisFunction) \ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 200 V(Calls) \ | 199 V(Calls) \ |
| 201 V(ContextSlots) \ | 200 V(ContextSlots) \ |
| 202 V(DoubleArrayElements) \ | 201 V(DoubleArrayElements) \ |
| 203 V(DoubleFields) \ | 202 V(DoubleFields) \ |
| 204 V(ElementsKind) \ | 203 V(ElementsKind) \ |
| 205 V(ElementsPointer) \ | 204 V(ElementsPointer) \ |
| 206 V(GlobalVars) \ | 205 V(GlobalVars) \ |
| 207 V(InobjectFields) \ | 206 V(InobjectFields) \ |
| 208 V(OsrEntries) \ | 207 V(OsrEntries) \ |
| 209 V(ExternalMemory) \ | 208 V(ExternalMemory) \ |
| 210 V(StringChars) | 209 V(StringChars) \ |
| 210 V(TypedArrayElements) |
| 211 | 211 |
| 212 | 212 |
| 213 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 213 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
| 214 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ | 214 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ |
| 215 static H##type* cast(HValue* value) { \ | 215 static H##type* cast(HValue* value) { \ |
| 216 ASSERT(value->Is##type()); \ | 216 ASSERT(value->Is##type()); \ |
| 217 return reinterpret_cast<H##type*>(value); \ | 217 return reinterpret_cast<H##type*>(value); \ |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 1574 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 1575 }; | 1575 }; |
| 1576 | 1576 |
| 1577 | 1577 |
| 1578 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> { | 1578 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> { |
| 1579 public: | 1579 public: |
| 1580 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); | 1580 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); |
| 1581 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); | 1581 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); |
| 1582 | 1582 |
| 1583 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1583 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1584 // TODO(titzer): require an Int32 input for faster returns. |
| 1585 if (index == 2) return Representation::Smi(); |
| 1584 return Representation::Tagged(); | 1586 return Representation::Tagged(); |
| 1585 } | 1587 } |
| 1586 | 1588 |
| 1587 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1589 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1588 | 1590 |
| 1589 HValue* value() { return OperandAt(0); } | 1591 HValue* value() { return OperandAt(0); } |
| 1590 HValue* context() { return OperandAt(1); } | 1592 HValue* context() { return OperandAt(1); } |
| 1591 HValue* parameter_count() { return OperandAt(2); } | 1593 HValue* parameter_count() { return OperandAt(2); } |
| 1592 | 1594 |
| 1593 DECLARE_CONCRETE_INSTRUCTION(Return) | 1595 DECLARE_CONCRETE_INSTRUCTION(Return) |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2505 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
| 2504 | 2506 |
| 2505 private: | 2507 private: |
| 2506 HCallNew(HValue* context, HValue* constructor, int argument_count) | 2508 HCallNew(HValue* context, HValue* constructor, int argument_count) |
| 2507 : HBinaryCall(context, constructor, argument_count) {} | 2509 : HBinaryCall(context, constructor, argument_count) {} |
| 2508 }; | 2510 }; |
| 2509 | 2511 |
| 2510 | 2512 |
| 2511 class HCallNewArray V8_FINAL : public HBinaryCall { | 2513 class HCallNewArray V8_FINAL : public HBinaryCall { |
| 2512 public: | 2514 public: |
| 2513 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HCallNewArray, | 2515 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray, |
| 2514 HValue*, | 2516 HValue*, |
| 2515 int, | 2517 int, |
| 2516 Handle<Cell>, | |
| 2517 ElementsKind); | 2518 ElementsKind); |
| 2518 | 2519 |
| 2519 HValue* context() { return first(); } | 2520 HValue* context() { return first(); } |
| 2520 HValue* constructor() { return second(); } | 2521 HValue* constructor() { return second(); } |
| 2521 | 2522 |
| 2522 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2523 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2523 | 2524 |
| 2524 Handle<Cell> property_cell() const { | |
| 2525 return type_cell_; | |
| 2526 } | |
| 2527 | |
| 2528 ElementsKind elements_kind() const { return elements_kind_; } | 2525 ElementsKind elements_kind() const { return elements_kind_; } |
| 2529 | 2526 |
| 2530 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) | 2527 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) |
| 2531 | 2528 |
| 2532 private: | 2529 private: |
| 2533 HCallNewArray(HValue* context, HValue* constructor, int argument_count, | 2530 HCallNewArray(HValue* context, HValue* constructor, int argument_count, |
| 2534 Handle<Cell> type_cell, ElementsKind elements_kind) | 2531 ElementsKind elements_kind) |
| 2535 : HBinaryCall(context, constructor, argument_count), | 2532 : HBinaryCall(context, constructor, argument_count), |
| 2536 elements_kind_(elements_kind), | 2533 elements_kind_(elements_kind) {} |
| 2537 type_cell_(type_cell) {} | |
| 2538 | 2534 |
| 2539 ElementsKind elements_kind_; | 2535 ElementsKind elements_kind_; |
| 2540 Handle<Cell> type_cell_; | |
| 2541 }; | 2536 }; |
| 2542 | 2537 |
| 2543 | 2538 |
| 2544 class HCallRuntime V8_FINAL : public HCall<1> { | 2539 class HCallRuntime V8_FINAL : public HCall<1> { |
| 2545 public: | 2540 public: |
| 2546 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, | 2541 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, |
| 2547 Handle<String>, | 2542 Handle<String>, |
| 2548 const Runtime::Function*, | 2543 const Runtime::Function*, |
| 2549 int); | 2544 int); |
| 2550 | 2545 |
| (...skipping 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5734 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), | 5729 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), |
| 5735 details_(details) { | 5730 details_(details) { |
| 5736 SetGVNFlag(kChangesGlobalVars); | 5731 SetGVNFlag(kChangesGlobalVars); |
| 5737 } | 5732 } |
| 5738 | 5733 |
| 5739 Unique<PropertyCell> cell_; | 5734 Unique<PropertyCell> cell_; |
| 5740 PropertyDetails details_; | 5735 PropertyDetails details_; |
| 5741 }; | 5736 }; |
| 5742 | 5737 |
| 5743 | 5738 |
| 5744 class HStoreGlobalGeneric : public HTemplateInstruction<3> { | |
| 5745 public: | |
| 5746 inline static HStoreGlobalGeneric* New(Zone* zone, | |
| 5747 HValue* context, | |
| 5748 HValue* global_object, | |
| 5749 Handle<Object> name, | |
| 5750 HValue* value, | |
| 5751 StrictModeFlag strict_mode_flag) { | |
| 5752 return new(zone) HStoreGlobalGeneric(context, global_object, | |
| 5753 name, value, strict_mode_flag); | |
| 5754 } | |
| 5755 | |
| 5756 HValue* context() { return OperandAt(0); } | |
| 5757 HValue* global_object() { return OperandAt(1); } | |
| 5758 Handle<Object> name() const { return name_; } | |
| 5759 HValue* value() { return OperandAt(2); } | |
| 5760 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } | |
| 5761 | |
| 5762 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 5763 | |
| 5764 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
| 5765 return Representation::Tagged(); | |
| 5766 } | |
| 5767 | |
| 5768 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) | |
| 5769 | |
| 5770 private: | |
| 5771 HStoreGlobalGeneric(HValue* context, | |
| 5772 HValue* global_object, | |
| 5773 Handle<Object> name, | |
| 5774 HValue* value, | |
| 5775 StrictModeFlag strict_mode_flag) | |
| 5776 : name_(name), | |
| 5777 strict_mode_flag_(strict_mode_flag) { | |
| 5778 SetOperandAt(0, context); | |
| 5779 SetOperandAt(1, global_object); | |
| 5780 SetOperandAt(2, value); | |
| 5781 set_representation(Representation::Tagged()); | |
| 5782 SetAllSideEffects(); | |
| 5783 } | |
| 5784 | |
| 5785 Handle<Object> name_; | |
| 5786 StrictModeFlag strict_mode_flag_; | |
| 5787 }; | |
| 5788 | |
| 5789 | |
| 5790 class HLoadContextSlot V8_FINAL : public HUnaryOperation { | 5739 class HLoadContextSlot V8_FINAL : public HUnaryOperation { |
| 5791 public: | 5740 public: |
| 5792 enum Mode { | 5741 enum Mode { |
| 5793 // Perform a normal load of the context slot without checking its value. | 5742 // Perform a normal load of the context slot without checking its value. |
| 5794 kNoCheck, | 5743 kNoCheck, |
| 5795 // Load and check the value of the context slot. Deoptimize if it's the | 5744 // Load and check the value of the context slot. Deoptimize if it's the |
| 5796 // hole value. This is used for checking for loading of uninitialized | 5745 // hole value. This is used for checking for loading of uninitialized |
| 5797 // harmony bindings where we deoptimize into full-codegen generated code | 5746 // harmony bindings where we deoptimize into full-codegen generated code |
| 5798 // which will subsequently throw a reference error. | 5747 // which will subsequently throw a reference error. |
| 5799 kCheckDeoptimize, | 5748 kCheckDeoptimize, |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6359 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6308 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
| 6360 public: | 6309 public: |
| 6361 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, | 6310 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, |
| 6362 ElementsKind); | 6311 ElementsKind); |
| 6363 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, | 6312 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, |
| 6364 ElementsKind, LoadKeyedHoleMode); | 6313 ElementsKind, LoadKeyedHoleMode); |
| 6365 | 6314 |
| 6366 bool is_external() const { | 6315 bool is_external() const { |
| 6367 return IsExternalArrayElementsKind(elements_kind()); | 6316 return IsExternalArrayElementsKind(elements_kind()); |
| 6368 } | 6317 } |
| 6318 bool is_fixed_typed_array() const { |
| 6319 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 6320 } |
| 6321 bool is_typed_elements() const { |
| 6322 return is_external() || is_fixed_typed_array(); |
| 6323 } |
| 6369 HValue* elements() { return OperandAt(0); } | 6324 HValue* elements() { return OperandAt(0); } |
| 6370 HValue* key() { return OperandAt(1); } | 6325 HValue* key() { return OperandAt(1); } |
| 6371 HValue* dependency() { | 6326 HValue* dependency() { |
| 6372 ASSERT(HasDependency()); | 6327 ASSERT(HasDependency()); |
| 6373 return OperandAt(2); | 6328 return OperandAt(2); |
| 6374 } | 6329 } |
| 6375 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6330 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
| 6376 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } | 6331 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } |
| 6377 void SetIndexOffset(uint32_t index_offset) { | 6332 void SetIndexOffset(uint32_t index_offset) { |
| 6378 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); | 6333 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); |
| 6379 } | 6334 } |
| 6380 virtual int MaxIndexOffsetBits() { | 6335 virtual int MaxIndexOffsetBits() { |
| 6381 return kBitsForIndexOffset; | 6336 return kBitsForIndexOffset; |
| 6382 } | 6337 } |
| 6383 HValue* GetKey() { return key(); } | 6338 HValue* GetKey() { return key(); } |
| 6384 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6339 void SetKey(HValue* key) { SetOperandAt(1, key); } |
| 6385 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } | 6340 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } |
| 6386 void SetDehoisted(bool is_dehoisted) { | 6341 void SetDehoisted(bool is_dehoisted) { |
| 6387 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6342 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
| 6388 } | 6343 } |
| 6389 ElementsKind elements_kind() const { | 6344 ElementsKind elements_kind() const { |
| 6390 return ElementsKindField::decode(bit_field_); | 6345 return ElementsKindField::decode(bit_field_); |
| 6391 } | 6346 } |
| 6392 LoadKeyedHoleMode hole_mode() const { | 6347 LoadKeyedHoleMode hole_mode() const { |
| 6393 return HoleModeField::decode(bit_field_); | 6348 return HoleModeField::decode(bit_field_); |
| 6394 } | 6349 } |
| 6395 | 6350 |
| 6396 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6351 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6397 // kind_fast: tagged[int32] (none) | 6352 // kind_fast: tagged[int32] (none) |
| 6398 // kind_double: tagged[int32] (none) | 6353 // kind_double: tagged[int32] (none) |
| 6399 // kind_external: external[int32] (none) | 6354 // kind_fixed_typed_array: tagged[int32] (none) |
| 6355 // kind_external: external[int32] (none) |
| 6400 if (index == 0) { | 6356 if (index == 0) { |
| 6401 return is_external() ? Representation::External() | 6357 return is_external() ? Representation::External() |
| 6402 : Representation::Tagged(); | 6358 : Representation::Tagged(); |
| 6403 } | 6359 } |
| 6404 if (index == 1) { | 6360 if (index == 1) { |
| 6405 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6361 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| 6406 OperandAt(1)->representation()); | 6362 OperandAt(1)->representation()); |
| 6407 } | 6363 } |
| 6408 return Representation::None(); | 6364 return Representation::None(); |
| 6409 } | 6365 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6439 ElementsKind elements_kind, | 6395 ElementsKind elements_kind, |
| 6440 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) | 6396 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) |
| 6441 : bit_field_(0) { | 6397 : bit_field_(0) { |
| 6442 bit_field_ = ElementsKindField::encode(elements_kind) | | 6398 bit_field_ = ElementsKindField::encode(elements_kind) | |
| 6443 HoleModeField::encode(mode); | 6399 HoleModeField::encode(mode); |
| 6444 | 6400 |
| 6445 SetOperandAt(0, obj); | 6401 SetOperandAt(0, obj); |
| 6446 SetOperandAt(1, key); | 6402 SetOperandAt(1, key); |
| 6447 SetOperandAt(2, dependency != NULL ? dependency : obj); | 6403 SetOperandAt(2, dependency != NULL ? dependency : obj); |
| 6448 | 6404 |
| 6449 if (!is_external()) { | 6405 if (!is_typed_elements()) { |
| 6450 // I can detect the case between storing double (holey and fast) and | 6406 // I can detect the case between storing double (holey and fast) and |
| 6451 // smi/object by looking at elements_kind_. | 6407 // smi/object by looking at elements_kind_. |
| 6452 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | 6408 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || |
| 6453 IsFastDoubleElementsKind(elements_kind)); | 6409 IsFastDoubleElementsKind(elements_kind)); |
| 6454 | 6410 |
| 6455 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | 6411 if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
| 6456 if (IsFastSmiElementsKind(elements_kind) && | 6412 if (IsFastSmiElementsKind(elements_kind) && |
| 6457 (!IsHoleyElementsKind(elements_kind) || | 6413 (!IsHoleyElementsKind(elements_kind) || |
| 6458 mode == NEVER_RETURN_HOLE)) { | 6414 mode == NEVER_RETURN_HOLE)) { |
| 6459 set_type(HType::Smi()); | 6415 set_type(HType::Smi()); |
| 6460 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { | 6416 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { |
| 6461 set_representation(Representation::Integer32()); | 6417 set_representation(Representation::Integer32()); |
| 6462 } else { | 6418 } else { |
| 6463 set_representation(Representation::Smi()); | 6419 set_representation(Representation::Smi()); |
| 6464 } | 6420 } |
| 6465 } else { | 6421 } else { |
| 6466 set_representation(Representation::Tagged()); | 6422 set_representation(Representation::Tagged()); |
| 6467 } | 6423 } |
| 6468 | 6424 |
| 6469 SetGVNFlag(kDependsOnArrayElements); | 6425 SetGVNFlag(kDependsOnArrayElements); |
| 6470 } else { | 6426 } else { |
| 6471 set_representation(Representation::Double()); | 6427 set_representation(Representation::Double()); |
| 6472 SetGVNFlag(kDependsOnDoubleArrayElements); | 6428 SetGVNFlag(kDependsOnDoubleArrayElements); |
| 6473 } | 6429 } |
| 6474 } else { | 6430 } else { |
| 6475 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 6431 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 6476 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 6432 elements_kind == EXTERNAL_DOUBLE_ELEMENTS || |
| 6433 elements_kind == FLOAT32_ELEMENTS || |
| 6434 elements_kind == FLOAT64_ELEMENTS) { |
| 6477 set_representation(Representation::Double()); | 6435 set_representation(Representation::Double()); |
| 6478 } else { | 6436 } else { |
| 6479 set_representation(Representation::Integer32()); | 6437 set_representation(Representation::Integer32()); |
| 6480 } | 6438 } |
| 6481 | 6439 |
| 6482 SetGVNFlag(kDependsOnExternalMemory); | 6440 if (is_external()) { |
| 6441 SetGVNFlag(kDependsOnExternalMemory); |
| 6442 } else if (is_fixed_typed_array()) { |
| 6443 SetGVNFlag(kDependsOnTypedArrayElements); |
| 6444 } else { |
| 6445 UNREACHABLE(); |
| 6446 } |
| 6483 // Native code could change the specialized array. | 6447 // Native code could change the specialized array. |
| 6484 SetGVNFlag(kDependsOnCalls); | 6448 SetGVNFlag(kDependsOnCalls); |
| 6485 } | 6449 } |
| 6486 | 6450 |
| 6487 SetFlag(kUseGVN); | 6451 SetFlag(kUseGVN); |
| 6488 } | 6452 } |
| 6489 | 6453 |
| 6490 virtual bool IsDeletable() const V8_OVERRIDE { | 6454 virtual bool IsDeletable() const V8_OVERRIDE { |
| 6491 return !RequiresHoleCheck(); | 6455 return !RequiresHoleCheck(); |
| 6492 } | 6456 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6731 | 6695 |
| 6732 class HStoreKeyed V8_FINAL | 6696 class HStoreKeyed V8_FINAL |
| 6733 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6697 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
| 6734 public: | 6698 public: |
| 6735 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | 6699 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6736 ElementsKind); | 6700 ElementsKind); |
| 6737 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | 6701 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6738 ElementsKind, StoreFieldOrKeyedMode); | 6702 ElementsKind, StoreFieldOrKeyedMode); |
| 6739 | 6703 |
| 6740 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6704 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6741 // kind_fast: tagged[int32] = tagged | 6705 // kind_fast: tagged[int32] = tagged |
| 6742 // kind_double: tagged[int32] = double | 6706 // kind_double: tagged[int32] = double |
| 6743 // kind_smi : tagged[int32] = smi | 6707 // kind_smi : tagged[int32] = smi |
| 6744 // kind_external: external[int32] = (double | int32) | 6708 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
| 6709 // kind_external: external[int32] = (double | int32) |
| 6745 if (index == 0) { | 6710 if (index == 0) { |
| 6746 return is_external() ? Representation::External() | 6711 return is_external() ? Representation::External() |
| 6747 : Representation::Tagged(); | 6712 : Representation::Tagged(); |
| 6748 } else if (index == 1) { | 6713 } else if (index == 1) { |
| 6749 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6714 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| 6750 OperandAt(1)->representation()); | 6715 OperandAt(1)->representation()); |
| 6751 } | 6716 } |
| 6752 | 6717 |
| 6753 ASSERT_EQ(index, 2); | 6718 ASSERT_EQ(index, 2); |
| 6754 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6719 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
| 6755 return Representation::Double(); | 6720 return Representation::Double(); |
| 6756 } | 6721 } |
| 6757 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | 6722 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { |
| 6758 return Representation::Integer32(); | 6723 return Representation::Integer32(); |
| 6759 } | 6724 } |
| 6760 if (IsFastSmiElementsKind(elements_kind())) { | 6725 if (IsFastSmiElementsKind(elements_kind())) { |
| 6761 return Representation::Smi(); | 6726 return Representation::Smi(); |
| 6762 } | 6727 } |
| 6763 | 6728 |
| 6764 return is_external() ? Representation::Integer32() | 6729 return is_external() || is_fixed_typed_array() |
| 6765 : Representation::Tagged(); | 6730 ? Representation::Integer32() |
| 6731 : Representation::Tagged(); |
| 6766 } | 6732 } |
| 6767 | 6733 |
| 6768 bool is_external() const { | 6734 bool is_external() const { |
| 6769 return IsExternalArrayElementsKind(elements_kind()); | 6735 return IsExternalArrayElementsKind(elements_kind()); |
| 6770 } | 6736 } |
| 6771 | 6737 |
| 6738 bool is_fixed_typed_array() const { |
| 6739 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 6740 } |
| 6741 |
| 6742 bool is_typed_elements() const { |
| 6743 return is_external() || is_fixed_typed_array(); |
| 6744 } |
| 6745 |
| 6772 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 6746 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
| 6773 if (index < 2) return RequiredInputRepresentation(index); | 6747 if (index < 2) return RequiredInputRepresentation(index); |
| 6774 if (IsUninitialized()) { | 6748 if (IsUninitialized()) { |
| 6775 return Representation::None(); | 6749 return Representation::None(); |
| 6776 } | 6750 } |
| 6777 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6751 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
| 6778 return Representation::Double(); | 6752 return Representation::Double(); |
| 6779 } | 6753 } |
| 6780 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | 6754 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { |
| 6781 return Representation::Integer32(); | 6755 return Representation::Integer32(); |
| 6782 } | 6756 } |
| 6783 if (IsFastSmiElementsKind(elements_kind())) { | 6757 if (IsFastSmiElementsKind(elements_kind())) { |
| 6784 return Representation::Smi(); | 6758 return Representation::Smi(); |
| 6785 } | 6759 } |
| 6786 if (is_external()) { | 6760 if (is_typed_elements()) { |
| 6787 return Representation::Integer32(); | 6761 return Representation::Integer32(); |
| 6788 } | 6762 } |
| 6789 // For fast object elements kinds, don't assume anything. | 6763 // For fast object elements kinds, don't assume anything. |
| 6790 return Representation::None(); | 6764 return Representation::None(); |
| 6791 } | 6765 } |
| 6792 | 6766 |
| 6793 HValue* elements() { return OperandAt(0); } | 6767 HValue* elements() { return OperandAt(0); } |
| 6794 HValue* key() { return OperandAt(1); } | 6768 HValue* key() { return OperandAt(1); } |
| 6795 HValue* value() { return OperandAt(2); } | 6769 HValue* value() { return OperandAt(2); } |
| 6796 bool value_is_smi() const { | 6770 bool value_is_smi() const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6861 SetFlag(kTrackSideEffectDominators); | 6835 SetFlag(kTrackSideEffectDominators); |
| 6862 SetGVNFlag(kDependsOnNewSpacePromotion); | 6836 SetGVNFlag(kDependsOnNewSpacePromotion); |
| 6863 } | 6837 } |
| 6864 if (is_external()) { | 6838 if (is_external()) { |
| 6865 SetGVNFlag(kChangesExternalMemory); | 6839 SetGVNFlag(kChangesExternalMemory); |
| 6866 SetFlag(kAllowUndefinedAsNaN); | 6840 SetFlag(kAllowUndefinedAsNaN); |
| 6867 } else if (IsFastDoubleElementsKind(elements_kind)) { | 6841 } else if (IsFastDoubleElementsKind(elements_kind)) { |
| 6868 SetGVNFlag(kChangesDoubleArrayElements); | 6842 SetGVNFlag(kChangesDoubleArrayElements); |
| 6869 } else if (IsFastSmiElementsKind(elements_kind)) { | 6843 } else if (IsFastSmiElementsKind(elements_kind)) { |
| 6870 SetGVNFlag(kChangesArrayElements); | 6844 SetGVNFlag(kChangesArrayElements); |
| 6845 } else if (is_fixed_typed_array()) { |
| 6846 SetGVNFlag(kChangesTypedArrayElements); |
| 6847 SetFlag(kAllowUndefinedAsNaN); |
| 6871 } else { | 6848 } else { |
| 6872 SetGVNFlag(kChangesArrayElements); | 6849 SetGVNFlag(kChangesArrayElements); |
| 6873 } | 6850 } |
| 6874 | 6851 |
| 6875 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 6852 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
| 6876 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 6853 if ((elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
| 6877 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 6854 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) || |
| 6855 (elements_kind >= UINT8_ELEMENTS && |
| 6856 elements_kind <= INT32_ELEMENTS)) { |
| 6878 SetFlag(kTruncatingToInt32); | 6857 SetFlag(kTruncatingToInt32); |
| 6879 } | 6858 } |
| 6880 } | 6859 } |
| 6881 | 6860 |
| 6882 ElementsKind elements_kind_; | 6861 ElementsKind elements_kind_; |
| 6883 uint32_t index_offset_; | 6862 uint32_t index_offset_; |
| 6884 bool is_dehoisted_ : 1; | 6863 bool is_dehoisted_ : 1; |
| 6885 bool is_uninitialized_ : 1; | 6864 bool is_uninitialized_ : 1; |
| 6886 StoreFieldOrKeyedMode store_mode_: 1; | 6865 StoreFieldOrKeyedMode store_mode_: 1; |
| 6887 HValue* new_space_dominator_; | 6866 HValue* new_space_dominator_; |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7576 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7555 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7577 }; | 7556 }; |
| 7578 | 7557 |
| 7579 | 7558 |
| 7580 #undef DECLARE_INSTRUCTION | 7559 #undef DECLARE_INSTRUCTION |
| 7581 #undef DECLARE_CONCRETE_INSTRUCTION | 7560 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7582 | 7561 |
| 7583 } } // namespace v8::internal | 7562 } } // namespace v8::internal |
| 7584 | 7563 |
| 7585 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7564 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |