OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 V(EnterInlined) \ | 97 V(EnterInlined) \ |
98 V(ExternalArrayLength) \ | 98 V(ExternalArrayLength) \ |
99 V(FixedArrayLength) \ | 99 V(FixedArrayLength) \ |
100 V(FunctionLiteral) \ | 100 V(FunctionLiteral) \ |
101 V(GetCachedArrayIndex) \ | 101 V(GetCachedArrayIndex) \ |
102 V(GlobalObject) \ | 102 V(GlobalObject) \ |
103 V(GlobalReceiver) \ | 103 V(GlobalReceiver) \ |
104 V(Goto) \ | 104 V(Goto) \ |
105 V(HasInstanceType) \ | 105 V(HasInstanceType) \ |
106 V(HasCachedArrayIndex) \ | 106 V(HasCachedArrayIndex) \ |
| 107 V(In) \ |
107 V(InstanceOf) \ | 108 V(InstanceOf) \ |
108 V(InstanceOfKnownGlobal) \ | 109 V(InstanceOfKnownGlobal) \ |
109 V(InvokeFunction) \ | 110 V(InvokeFunction) \ |
110 V(IsNull) \ | 111 V(IsNull) \ |
111 V(IsObject) \ | 112 V(IsObject) \ |
112 V(IsSmi) \ | 113 V(IsSmi) \ |
113 V(IsConstructCall) \ | 114 V(IsConstructCall) \ |
114 V(JSArrayLength) \ | 115 V(JSArrayLength) \ |
115 V(LeaveInlined) \ | 116 V(LeaveInlined) \ |
116 V(LoadContextSlot) \ | 117 V(LoadContextSlot) \ |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 397 |
397 // Make sure type fits in int16. | 398 // Make sure type fits in int16. |
398 STATIC_ASSERT(kUninitialized < (1 << (2 * kBitsPerByte))); | 399 STATIC_ASSERT(kUninitialized < (1 << (2 * kBitsPerByte))); |
399 | 400 |
400 explicit HType(Type t) : type_(t) { } | 401 explicit HType(Type t) : type_(t) { } |
401 | 402 |
402 int16_t type_; | 403 int16_t type_; |
403 }; | 404 }; |
404 | 405 |
405 | 406 |
| 407 class HUseListNode: public ZoneObject { |
| 408 public: |
| 409 HUseListNode(HValue* value, int index, HUseListNode* tail) |
| 410 : tail_(tail), value_(value), index_(index) { |
| 411 } |
| 412 |
| 413 HUseListNode* tail() const { return tail_; } |
| 414 HValue* value() const { return value_; } |
| 415 int index() const { return index_; } |
| 416 |
| 417 void set_tail(HUseListNode* list) { tail_ = list; } |
| 418 |
| 419 #ifdef DEBUG |
| 420 void Zap() { |
| 421 tail_ = reinterpret_cast<HUseListNode*>(1); |
| 422 value_ = NULL; |
| 423 index_ = -1; |
| 424 } |
| 425 #endif |
| 426 |
| 427 private: |
| 428 HUseListNode* tail_; |
| 429 HValue* value_; |
| 430 int index_; |
| 431 }; |
| 432 |
| 433 |
| 434 // We reuse use list nodes behind the scenes as uses are added and deleted. |
| 435 // This class is the safe way to iterate uses while deleting them. |
| 436 class HUseIterator BASE_EMBEDDED { |
| 437 public: |
| 438 bool Done() { return current_ == NULL; } |
| 439 void Advance(); |
| 440 |
| 441 HValue* value() { |
| 442 ASSERT(!Done()); |
| 443 return value_; |
| 444 } |
| 445 |
| 446 int index() { |
| 447 ASSERT(!Done()); |
| 448 return index_; |
| 449 } |
| 450 |
| 451 private: |
| 452 explicit HUseIterator(HUseListNode* head); |
| 453 |
| 454 HUseListNode* current_; |
| 455 HUseListNode* next_; |
| 456 HValue* value_; |
| 457 int index_; |
| 458 |
| 459 friend class HValue; |
| 460 }; |
| 461 |
| 462 |
406 class HValue: public ZoneObject { | 463 class HValue: public ZoneObject { |
407 public: | 464 public: |
408 static const int kNoNumber = -1; | 465 static const int kNoNumber = -1; |
409 | 466 |
410 // There must be one corresponding kDepends flag for every kChanges flag and | 467 // There must be one corresponding kDepends flag for every kChanges flag and |
411 // the order of the kChanges flags must be exactly the same as of the kDepends | 468 // the order of the kChanges flags must be exactly the same as of the kDepends |
412 // flags. | 469 // flags. |
413 enum Flag { | 470 enum Flag { |
414 // Declare global value numbering flags. | 471 // Declare global value numbering flags. |
415 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, | 472 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 523 |
467 // Declare virtual predicates for abstract HInstruction or HValue | 524 // Declare virtual predicates for abstract HInstruction or HValue |
468 #define DECLARE_PREDICATE(type) \ | 525 #define DECLARE_PREDICATE(type) \ |
469 virtual bool Is##type() const { return false; } | 526 virtual bool Is##type() const { return false; } |
470 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) | 527 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) |
471 #undef DECLARE_PREDICATE | 528 #undef DECLARE_PREDICATE |
472 | 529 |
473 HValue() : block_(NULL), | 530 HValue() : block_(NULL), |
474 id_(kNoNumber), | 531 id_(kNoNumber), |
475 type_(HType::Tagged()), | 532 type_(HType::Tagged()), |
| 533 use_list_(NULL), |
476 range_(NULL), | 534 range_(NULL), |
477 flags_(0) {} | 535 flags_(0) {} |
478 virtual ~HValue() {} | 536 virtual ~HValue() {} |
479 | 537 |
480 HBasicBlock* block() const { return block_; } | 538 HBasicBlock* block() const { return block_; } |
481 void SetBlock(HBasicBlock* block); | 539 void SetBlock(HBasicBlock* block); |
482 | 540 |
483 int id() const { return id_; } | 541 int id() const { return id_; } |
484 void set_id(int id) { id_ = id; } | 542 void set_id(int id) { id_ = id; } |
485 | 543 |
486 SmallPointerList<HValue>* uses() { return &uses_; } | 544 HUseIterator uses() const { return HUseIterator(use_list_); } |
487 | 545 |
488 virtual bool EmitAtUses() { return false; } | 546 virtual bool EmitAtUses() { return false; } |
489 Representation representation() const { return representation_; } | 547 Representation representation() const { return representation_; } |
490 void ChangeRepresentation(Representation r) { | 548 void ChangeRepresentation(Representation r) { |
491 // Representation was already set and is allowed to be changed. | 549 // Representation was already set and is allowed to be changed. |
492 ASSERT(!representation_.IsNone()); | 550 ASSERT(!representation_.IsNone()); |
493 ASSERT(!r.IsNone()); | 551 ASSERT(!r.IsNone()); |
494 ASSERT(CheckFlag(kFlexibleRepresentation)); | 552 ASSERT(CheckFlag(kFlexibleRepresentation)); |
495 RepresentationChanged(r); | 553 RepresentationChanged(r); |
496 representation_ = r; | 554 representation_ = r; |
497 } | 555 } |
498 | 556 |
499 HType type() const { return type_; } | 557 HType type() const { return type_; } |
500 void set_type(HType type) { | 558 void set_type(HType type) { |
501 ASSERT(uses_.length() == 0); | 559 ASSERT(HasNoUses()); |
502 type_ = type; | 560 type_ = type; |
503 } | 561 } |
504 | 562 |
505 // An operation needs to override this function iff: | 563 // An operation needs to override this function iff: |
506 // 1) it can produce an int32 output. | 564 // 1) it can produce an int32 output. |
507 // 2) the true value of its output can potentially be minus zero. | 565 // 2) the true value of its output can potentially be minus zero. |
508 // The implementation must set a flag so that it bails out in the case where | 566 // The implementation must set a flag so that it bails out in the case where |
509 // it would otherwise output what should be a minus zero as an int32 zero. | 567 // it would otherwise output what should be a minus zero as an int32 zero. |
510 // If the operation also exists in a form that takes int32 and outputs int32 | 568 // If the operation also exists in a form that takes int32 and outputs int32 |
511 // then the operation should return its input value so that we can propagate | 569 // then the operation should return its input value so that we can propagate |
512 // back. There are two operations that need to propagate back to more than | 570 // back. There are two operations that need to propagate back to more than |
513 // one input. They are phi and binary add. They always return NULL and | 571 // one input. They are phi and binary add. They always return NULL and |
514 // expect the caller to take care of things. | 572 // expect the caller to take care of things. |
515 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { | 573 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { |
516 visited->Add(id()); | 574 visited->Add(id()); |
517 return NULL; | 575 return NULL; |
518 } | 576 } |
519 | 577 |
520 bool IsDefinedAfter(HBasicBlock* other) const; | 578 bool IsDefinedAfter(HBasicBlock* other) const; |
521 | 579 |
522 // Operands. | 580 // Operands. |
523 virtual int OperandCount() = 0; | 581 virtual int OperandCount() = 0; |
524 virtual HValue* OperandAt(int index) = 0; | 582 virtual HValue* OperandAt(int index) = 0; |
525 void SetOperandAt(int index, HValue* value); | 583 void SetOperandAt(int index, HValue* value); |
526 | 584 |
527 int LookupOperandIndex(int occurrence_index, HValue* op); | 585 void DeleteAndReplaceWith(HValue* other); |
528 bool UsesMultipleTimes(HValue* op); | 586 bool HasNoUses() const { return use_list_ == NULL; } |
529 | 587 bool HasMultipleUses() const { |
530 void ReplaceAndDelete(HValue* other); | 588 return use_list_ != NULL && use_list_->tail() != NULL; |
531 void ReplaceValue(HValue* other); | 589 } |
532 void ReplaceAtUse(HValue* use, HValue* other); | 590 int UseCount() const; |
533 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r); | |
534 bool HasNoUses() const { return uses_.is_empty(); } | |
535 void ClearOperands(); | 591 void ClearOperands(); |
536 void Delete(); | |
537 | 592 |
538 int flags() const { return flags_; } | 593 int flags() const { return flags_; } |
539 void SetFlag(Flag f) { flags_ |= (1 << f); } | 594 void SetFlag(Flag f) { flags_ |= (1 << f); } |
540 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } | 595 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
541 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } | 596 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
542 | 597 |
543 void SetAllSideEffects() { flags_ |= AllSideEffects(); } | 598 void SetAllSideEffects() { flags_ |= AllSideEffects(); } |
544 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } | 599 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } |
545 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } | 600 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } |
546 | 601 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 ASSERT(representation_.IsNone() && !r.IsNone()); | 659 ASSERT(representation_.IsNone() && !r.IsNone()); |
605 representation_ = r; | 660 representation_ = r; |
606 } | 661 } |
607 | 662 |
608 private: | 663 private: |
609 // A flag mask to mark an instruction as having arbitrary side effects. | 664 // A flag mask to mark an instruction as having arbitrary side effects. |
610 static int AllSideEffects() { | 665 static int AllSideEffects() { |
611 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); | 666 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); |
612 } | 667 } |
613 | 668 |
614 void InternalReplaceAtUse(HValue* use, HValue* other); | 669 // Remove the matching use from the use list if present. Returns the |
| 670 // removed list node or NULL. |
| 671 HUseListNode* RemoveUse(HValue* value, int index); |
| 672 |
| 673 void ReplaceAllUsesWith(HValue* other); |
| 674 |
615 void RegisterUse(int index, HValue* new_value); | 675 void RegisterUse(int index, HValue* new_value); |
616 | 676 |
617 HBasicBlock* block_; | 677 HBasicBlock* block_; |
618 | 678 |
619 // The id of this instruction in the hydrogen graph, assigned when first | 679 // The id of this instruction in the hydrogen graph, assigned when first |
620 // added to the graph. Reflects creation order. | 680 // added to the graph. Reflects creation order. |
621 int id_; | 681 int id_; |
622 | 682 |
623 Representation representation_; | 683 Representation representation_; |
624 HType type_; | 684 HType type_; |
625 SmallPointerList<HValue> uses_; | 685 HUseListNode* use_list_; |
626 Range* range_; | 686 Range* range_; |
627 int flags_; | 687 int flags_; |
628 | 688 |
629 DISALLOW_COPY_AND_ASSIGN(HValue); | 689 DISALLOW_COPY_AND_ASSIGN(HValue); |
630 }; | 690 }; |
631 | 691 |
632 | 692 |
633 class HInstruction: public HValue { | 693 class HInstruction: public HValue { |
634 public: | 694 public: |
635 HInstruction* next() const { return next_; } | 695 HInstruction* next() const { return next_; } |
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 HCompare(HValue* left, HValue* right, Token::Value token) | 2310 HCompare(HValue* left, HValue* right, Token::Value token) |
2251 : HBinaryOperation(left, right), token_(token) { | 2311 : HBinaryOperation(left, right), token_(token) { |
2252 ASSERT(Token::IsCompareOp(token)); | 2312 ASSERT(Token::IsCompareOp(token)); |
2253 set_representation(Representation::Tagged()); | 2313 set_representation(Representation::Tagged()); |
2254 SetAllSideEffects(); | 2314 SetAllSideEffects(); |
2255 } | 2315 } |
2256 | 2316 |
2257 void SetInputRepresentation(Representation r); | 2317 void SetInputRepresentation(Representation r); |
2258 | 2318 |
2259 virtual bool EmitAtUses() { | 2319 virtual bool EmitAtUses() { |
2260 return !HasSideEffects() && (uses()->length() <= 1); | 2320 return !HasSideEffects() && !HasMultipleUses(); |
2261 } | 2321 } |
2262 | 2322 |
2263 virtual Representation RequiredInputRepresentation(int index) const { | 2323 virtual Representation RequiredInputRepresentation(int index) const { |
2264 return input_representation_; | 2324 return input_representation_; |
2265 } | 2325 } |
2266 Representation GetInputRepresentation() const { | 2326 Representation GetInputRepresentation() const { |
2267 return input_representation_; | 2327 return input_representation_; |
2268 } | 2328 } |
2269 Token::Value token() const { return token_; } | 2329 Token::Value token() const { return token_; } |
2270 virtual void PrintDataTo(StringStream* stream); | 2330 virtual void PrintDataTo(StringStream* stream); |
(...skipping 21 matching lines...) Expand all Loading... |
2292 class HCompareJSObjectEq: public HBinaryOperation { | 2352 class HCompareJSObjectEq: public HBinaryOperation { |
2293 public: | 2353 public: |
2294 HCompareJSObjectEq(HValue* left, HValue* right) | 2354 HCompareJSObjectEq(HValue* left, HValue* right) |
2295 : HBinaryOperation(left, right) { | 2355 : HBinaryOperation(left, right) { |
2296 set_representation(Representation::Tagged()); | 2356 set_representation(Representation::Tagged()); |
2297 SetFlag(kUseGVN); | 2357 SetFlag(kUseGVN); |
2298 SetFlag(kDependsOnMaps); | 2358 SetFlag(kDependsOnMaps); |
2299 } | 2359 } |
2300 | 2360 |
2301 virtual bool EmitAtUses() { | 2361 virtual bool EmitAtUses() { |
2302 return !HasSideEffects() && (uses()->length() <= 1); | 2362 return !HasSideEffects() && !HasMultipleUses(); |
2303 } | 2363 } |
2304 | 2364 |
2305 virtual Representation RequiredInputRepresentation(int index) const { | 2365 virtual Representation RequiredInputRepresentation(int index) const { |
2306 return Representation::Tagged(); | 2366 return Representation::Tagged(); |
2307 } | 2367 } |
2308 virtual HType CalculateInferredType(); | 2368 virtual HType CalculateInferredType(); |
2309 | 2369 |
2310 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq) | 2370 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq) |
2311 | 2371 |
2312 protected: | 2372 protected: |
2313 virtual bool DataEquals(HValue* other) { return true; } | 2373 virtual bool DataEquals(HValue* other) { return true; } |
2314 }; | 2374 }; |
2315 | 2375 |
2316 | 2376 |
2317 class HUnaryPredicate: public HUnaryOperation { | 2377 class HUnaryPredicate: public HUnaryOperation { |
2318 public: | 2378 public: |
2319 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | 2379 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
2320 set_representation(Representation::Tagged()); | 2380 set_representation(Representation::Tagged()); |
2321 SetFlag(kUseGVN); | 2381 SetFlag(kUseGVN); |
2322 } | 2382 } |
2323 | 2383 |
2324 virtual bool EmitAtUses() { | 2384 virtual bool EmitAtUses() { |
2325 return !HasSideEffects() && (uses()->length() <= 1); | 2385 return !HasSideEffects() && !HasMultipleUses(); |
2326 } | 2386 } |
2327 | 2387 |
2328 virtual Representation RequiredInputRepresentation(int index) const { | 2388 virtual Representation RequiredInputRepresentation(int index) const { |
2329 return Representation::Tagged(); | 2389 return Representation::Tagged(); |
2330 } | 2390 } |
2331 virtual HType CalculateInferredType(); | 2391 virtual HType CalculateInferredType(); |
2332 }; | 2392 }; |
2333 | 2393 |
2334 | 2394 |
2335 class HIsNull: public HUnaryPredicate { | 2395 class HIsNull: public HUnaryPredicate { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 | 2435 |
2376 | 2436 |
2377 class HIsConstructCall: public HTemplateInstruction<0> { | 2437 class HIsConstructCall: public HTemplateInstruction<0> { |
2378 public: | 2438 public: |
2379 HIsConstructCall() { | 2439 HIsConstructCall() { |
2380 set_representation(Representation::Tagged()); | 2440 set_representation(Representation::Tagged()); |
2381 SetFlag(kUseGVN); | 2441 SetFlag(kUseGVN); |
2382 } | 2442 } |
2383 | 2443 |
2384 virtual bool EmitAtUses() { | 2444 virtual bool EmitAtUses() { |
2385 return !HasSideEffects() && (uses()->length() <= 1); | 2445 return !HasSideEffects() && !HasMultipleUses(); |
2386 } | 2446 } |
2387 | 2447 |
2388 virtual Representation RequiredInputRepresentation(int index) const { | 2448 virtual Representation RequiredInputRepresentation(int index) const { |
2389 return Representation::None(); | 2449 return Representation::None(); |
2390 } | 2450 } |
2391 | 2451 |
2392 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall) | 2452 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall) |
2393 | 2453 |
2394 protected: | 2454 protected: |
2395 virtual bool DataEquals(HValue* other) { return true; } | 2455 virtual bool DataEquals(HValue* other) { return true; } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 SetOperandAt(2, right); | 2557 SetOperandAt(2, right); |
2498 set_representation(Representation::Tagged()); | 2558 set_representation(Representation::Tagged()); |
2499 SetAllSideEffects(); | 2559 SetAllSideEffects(); |
2500 } | 2560 } |
2501 | 2561 |
2502 HValue* context() { return OperandAt(0); } | 2562 HValue* context() { return OperandAt(0); } |
2503 HValue* left() { return OperandAt(1); } | 2563 HValue* left() { return OperandAt(1); } |
2504 HValue* right() { return OperandAt(2); } | 2564 HValue* right() { return OperandAt(2); } |
2505 | 2565 |
2506 virtual bool EmitAtUses() { | 2566 virtual bool EmitAtUses() { |
2507 return !HasSideEffects() && (uses()->length() <= 1); | 2567 return !HasSideEffects() && !HasMultipleUses(); |
2508 } | 2568 } |
2509 | 2569 |
2510 virtual Representation RequiredInputRepresentation(int index) const { | 2570 virtual Representation RequiredInputRepresentation(int index) const { |
2511 return Representation::Tagged(); | 2571 return Representation::Tagged(); |
2512 } | 2572 } |
2513 | 2573 |
2514 virtual void PrintDataTo(StringStream* stream); | 2574 virtual void PrintDataTo(StringStream* stream); |
2515 | 2575 |
2516 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 2576 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
2517 }; | 2577 }; |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3180 }; | 3240 }; |
3181 | 3241 |
3182 | 3242 |
3183 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { | 3243 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { |
3184 public: | 3244 public: |
3185 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 3245 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
3186 HValue* key, | 3246 HValue* key, |
3187 ExternalArrayType array_type) | 3247 ExternalArrayType array_type) |
3188 : HBinaryOperation(external_elements, key), | 3248 : HBinaryOperation(external_elements, key), |
3189 array_type_(array_type) { | 3249 array_type_(array_type) { |
3190 if (array_type == kExternalFloatArray) { | 3250 if (array_type == kExternalFloatArray || |
| 3251 array_type == kExternalDoubleArray) { |
3191 set_representation(Representation::Double()); | 3252 set_representation(Representation::Double()); |
3192 } else { | 3253 } else { |
3193 set_representation(Representation::Integer32()); | 3254 set_representation(Representation::Integer32()); |
3194 } | 3255 } |
3195 SetFlag(kDependsOnSpecializedArrayElements); | 3256 SetFlag(kDependsOnSpecializedArrayElements); |
3196 // Native code could change the specialized array. | 3257 // Native code could change the specialized array. |
3197 SetFlag(kDependsOnCalls); | 3258 SetFlag(kDependsOnCalls); |
3198 SetFlag(kUseGVN); | 3259 SetFlag(kUseGVN); |
3199 } | 3260 } |
3200 | 3261 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 SetOperandAt(1, key); | 3433 SetOperandAt(1, key); |
3373 SetOperandAt(2, val); | 3434 SetOperandAt(2, val); |
3374 } | 3435 } |
3375 | 3436 |
3376 virtual void PrintDataTo(StringStream* stream); | 3437 virtual void PrintDataTo(StringStream* stream); |
3377 | 3438 |
3378 virtual Representation RequiredInputRepresentation(int index) const { | 3439 virtual Representation RequiredInputRepresentation(int index) const { |
3379 if (index == 0) { | 3440 if (index == 0) { |
3380 return Representation::External(); | 3441 return Representation::External(); |
3381 } else { | 3442 } else { |
3382 if (index == 2 && array_type() == kExternalFloatArray) { | 3443 if (index == 2 && (array_type() == kExternalFloatArray || |
| 3444 array_type() == kExternalDoubleArray)) { |
3383 return Representation::Double(); | 3445 return Representation::Double(); |
3384 } else { | 3446 } else { |
3385 return Representation::Integer32(); | 3447 return Representation::Integer32(); |
3386 } | 3448 } |
3387 } | 3449 } |
3388 } | 3450 } |
3389 | 3451 |
3390 HValue* external_pointer() { return OperandAt(0); } | 3452 HValue* external_pointer() { return OperandAt(0); } |
3391 HValue* key() { return OperandAt(1); } | 3453 HValue* key() { return OperandAt(1); } |
3392 HValue* value() { return OperandAt(2); } | 3454 HValue* value() { return OperandAt(2); } |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3712 virtual Representation RequiredInputRepresentation(int index) const { | 3774 virtual Representation RequiredInputRepresentation(int index) const { |
3713 return Representation::Tagged(); | 3775 return Representation::Tagged(); |
3714 } | 3776 } |
3715 | 3777 |
3716 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) | 3778 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) |
3717 | 3779 |
3718 HValue* object() { return left(); } | 3780 HValue* object() { return left(); } |
3719 HValue* key() { return right(); } | 3781 HValue* key() { return right(); } |
3720 }; | 3782 }; |
3721 | 3783 |
| 3784 |
| 3785 class HIn: public HTemplateInstruction<2> { |
| 3786 public: |
| 3787 HIn(HValue* key, HValue* object) { |
| 3788 SetOperandAt(0, key); |
| 3789 SetOperandAt(1, object); |
| 3790 set_representation(Representation::Tagged()); |
| 3791 SetAllSideEffects(); |
| 3792 } |
| 3793 |
| 3794 HValue* key() { return OperandAt(0); } |
| 3795 HValue* object() { return OperandAt(1); } |
| 3796 |
| 3797 virtual Representation RequiredInputRepresentation(int index) const { |
| 3798 return Representation::Tagged(); |
| 3799 } |
| 3800 |
| 3801 virtual HType CalculateInferredType() { |
| 3802 return HType::Boolean(); |
| 3803 } |
| 3804 |
| 3805 virtual void PrintDataTo(StringStream* stream); |
| 3806 |
| 3807 DECLARE_CONCRETE_INSTRUCTION(In) |
| 3808 }; |
| 3809 |
3722 #undef DECLARE_INSTRUCTION | 3810 #undef DECLARE_INSTRUCTION |
3723 #undef DECLARE_CONCRETE_INSTRUCTION | 3811 #undef DECLARE_CONCRETE_INSTRUCTION |
3724 | 3812 |
3725 } } // namespace v8::internal | 3813 } } // namespace v8::internal |
3726 | 3814 |
3727 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3815 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |