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 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2416 | 2416 |
2417 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi) | 2417 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi) |
2418 | 2418 |
2419 protected: | 2419 protected: |
2420 virtual bool DataEquals(HValue* other) { return true; } | 2420 virtual bool DataEquals(HValue* other) { return true; } |
2421 }; | 2421 }; |
2422 | 2422 |
2423 | 2423 |
2424 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 2424 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
2425 public: | 2425 public: |
2426 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 2426 HCheckPrototypeMaps(Handle<JSObject> prototype, |
2427 : prototype_(prototype), holder_(holder) { | 2427 Handle<JSObject> holder, |
2428 Zone* zone) : prototypes_(2, zone), maps_(2, zone) { | |
2428 SetFlag(kUseGVN); | 2429 SetFlag(kUseGVN); |
2429 SetGVNFlag(kDependsOnMaps); | 2430 SetGVNFlag(kDependsOnMaps); |
2431 // Keep a list of all objects on the prototype chain up to the holder | |
2432 // and the expected maps. | |
2433 while (true) { | |
2434 prototypes_.Add(prototype, zone); | |
2435 maps_.Add(Handle<Map>(prototype->map()), zone); | |
2436 if (prototype.is_identical_to(holder)) break; | |
2437 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); | |
2438 } | |
2430 } | 2439 } |
2431 | 2440 |
2432 Handle<JSObject> prototype() const { return prototype_; } | 2441 ZoneList< Handle<JSObject> >* prototypes() { return &prototypes_; } |
2433 Handle<JSObject> holder() const { return holder_; } | 2442 |
Michael Starzinger
2013/01/15 11:12:37
Drop the empty newline.
| |
2443 ZoneList< Handle<Map> >* maps() { return &maps_; } | |
2434 | 2444 |
2435 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) | 2445 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
2436 | 2446 |
2437 virtual Representation RequiredInputRepresentation(int index) { | 2447 virtual Representation RequiredInputRepresentation(int index) { |
2438 return Representation::None(); | 2448 return Representation::None(); |
2439 } | 2449 } |
2440 | 2450 |
2441 virtual void PrintDataTo(StringStream* stream); | 2451 virtual void PrintDataTo(StringStream* stream); |
2442 | 2452 |
2443 virtual intptr_t Hashcode() { | 2453 virtual intptr_t Hashcode() { |
2444 ASSERT_ALLOCATION_DISABLED; | 2454 ASSERT_ALLOCATION_DISABLED; |
2445 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); | 2455 intptr_t hash = 0; |
2446 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); | 2456 for (int i = 0; i < prototypes_.length(); i++) { |
2457 hash = 17 * hash + reinterpret_cast<intptr_t>(*prototypes_[i]); | |
2458 hash = 17 * hash + reinterpret_cast<intptr_t>(*maps_[i]); | |
2459 } | |
2447 return hash; | 2460 return hash; |
2448 } | 2461 } |
2449 | 2462 |
2450 protected: | 2463 protected: |
2451 virtual bool DataEquals(HValue* other) { | 2464 virtual bool DataEquals(HValue* other) { |
2452 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); | 2465 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
2453 return prototype_.is_identical_to(b->prototype()) && | 2466 if (prototypes_.length() != b->prototypes()->length()) return false; |
2454 holder_.is_identical_to(b->holder()); | 2467 for (int i = 0; i < prototypes_.length(); i++) { |
2468 if (!prototypes_[i].is_identical_to(b->prototypes()->at(i))) return false; | |
2469 if (!maps_[i].is_identical_to(b->maps()->at(i))) return false; | |
2470 } | |
2471 return true; | |
Michael Starzinger
2013/01/15 11:12:37
The original implementation of just comparing prot
| |
2455 } | 2472 } |
2456 | 2473 |
2457 private: | 2474 private: |
2458 Handle<JSObject> prototype_; | 2475 ZoneList< Handle<JSObject> > prototypes_; |
Michael Starzinger
2013/01/15 11:12:37
The rest of the code-base doesn't have a space bet
| |
2459 Handle<JSObject> holder_; | 2476 ZoneList< Handle<Map> > maps_; |
2460 }; | 2477 }; |
2461 | 2478 |
2462 | 2479 |
2463 class HCheckSmi: public HUnaryOperation { | 2480 class HCheckSmi: public HUnaryOperation { |
2464 public: | 2481 public: |
2465 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 2482 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
2466 set_representation(Representation::Tagged()); | 2483 set_representation(Representation::Tagged()); |
2467 SetFlag(kUseGVN); | 2484 SetFlag(kUseGVN); |
2468 } | 2485 } |
2469 | 2486 |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3582 HSub(HValue* context, HValue* left, HValue* right) | 3599 HSub(HValue* context, HValue* left, HValue* right) |
3583 : HArithmeticBinaryOperation(context, left, right) { | 3600 : HArithmeticBinaryOperation(context, left, right) { |
3584 SetFlag(kCanOverflow); | 3601 SetFlag(kCanOverflow); |
3585 } | 3602 } |
3586 | 3603 |
3587 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 3604 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
3588 | 3605 |
3589 virtual HValue* Canonicalize(); | 3606 virtual HValue* Canonicalize(); |
3590 | 3607 |
3591 static HInstruction* NewHSub(Zone* zone, | 3608 static HInstruction* NewHSub(Zone* zone, |
3592 HValue* context, | 3609 HValue* context, |
3593 HValue* left, | 3610 HValue* left, |
3594 HValue* right); | 3611 HValue* right); |
3595 | 3612 |
3596 DECLARE_CONCRETE_INSTRUCTION(Sub) | 3613 DECLARE_CONCRETE_INSTRUCTION(Sub) |
3597 | 3614 |
3598 protected: | 3615 protected: |
3599 virtual bool DataEquals(HValue* other) { return true; } | 3616 virtual bool DataEquals(HValue* other) { return true; } |
3600 | 3617 |
3601 virtual Range* InferRange(Zone* zone); | 3618 virtual Range* InferRange(Zone* zone); |
3602 }; | 3619 }; |
3603 | 3620 |
3604 | 3621 |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5446 virtual bool IsDeletable() const { return true; } | 5463 virtual bool IsDeletable() const { return true; } |
5447 }; | 5464 }; |
5448 | 5465 |
5449 | 5466 |
5450 #undef DECLARE_INSTRUCTION | 5467 #undef DECLARE_INSTRUCTION |
5451 #undef DECLARE_CONCRETE_INSTRUCTION | 5468 #undef DECLARE_CONCRETE_INSTRUCTION |
5452 | 5469 |
5453 } } // namespace v8::internal | 5470 } } // namespace v8::internal |
5454 | 5471 |
5455 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5472 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |