| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 if (!iter.IsAtEnd()) { | 2546 if (!iter.IsAtEnd()) { |
| 2547 DCHECK_EQ(false, cell_reports_intact); | 2547 DCHECK_EQ(false, cell_reports_intact); |
| 2548 return cell_reports_intact; | 2548 return cell_reports_intact; |
| 2549 } | 2549 } |
| 2550 | 2550 |
| 2551 #endif | 2551 #endif |
| 2552 | 2552 |
| 2553 return cell_reports_intact; | 2553 return cell_reports_intact; |
| 2554 } | 2554 } |
| 2555 | 2555 |
| 2556 bool Isolate::IsArraySpeciesLookupChainIntact() { | |
| 2557 if (!FLAG_harmony_species) return true; | |
| 2558 // Note: It would be nice to have debug checks to make sure that the | |
| 2559 // species protector is accurate, but this would be hard to do for most of | |
| 2560 // what the protector stands for: | |
| 2561 // - You'd need to traverse the heap to check that no Array instance has | |
| 2562 // a constructor property | |
| 2563 // - To check that Array[Symbol.species] == Array, JS code has to execute, | |
| 2564 // but JS cannot be invoked in callstack overflow situations | |
| 2565 // All that could be checked reliably is that | |
| 2566 // Array.prototype.constructor == Array. Given that limitation, no check is | |
| 2567 // done here. In place, there are mjsunit tests harmony/array-species* which | |
| 2568 // ensure that behavior is correct in various invalid protector cases. | |
| 2569 | |
| 2570 PropertyCell* species_cell = heap()->species_protector(); | |
| 2571 return species_cell->value()->IsSmi() && | |
| 2572 Smi::cast(species_cell->value())->value() == kArrayProtectorValid; | |
| 2573 } | |
| 2574 | |
| 2575 void Isolate::InvalidateArraySpeciesProtector() { | 2556 void Isolate::InvalidateArraySpeciesProtector() { |
| 2576 if (!FLAG_harmony_species) return; | 2557 if (!FLAG_harmony_species) return; |
| 2577 DCHECK(factory()->species_protector()->value()->IsSmi()); | 2558 DCHECK(factory()->species_protector()->value()->IsSmi()); |
| 2578 DCHECK(IsArraySpeciesLookupChainIntact()); | 2559 DCHECK(IsArraySpeciesLookupChainIntact()); |
| 2579 PropertyCell::SetValueWithInvalidation( | 2560 PropertyCell::SetValueWithInvalidation( |
| 2580 factory()->species_protector(), | 2561 factory()->species_protector(), |
| 2581 handle(Smi::FromInt(kArrayProtectorInvalid), this)); | 2562 handle(Smi::FromInt(kArrayProtectorInvalid), this)); |
| 2582 DCHECK(!IsArraySpeciesLookupChainIntact()); | 2563 DCHECK(!IsArraySpeciesLookupChainIntact()); |
| 2583 } | 2564 } |
| 2584 | 2565 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2999 // Then check whether this scope intercepts. | 2980 // Then check whether this scope intercepts. |
| 3000 if ((flag & intercept_mask_)) { | 2981 if ((flag & intercept_mask_)) { |
| 3001 intercepted_flags_ |= flag; | 2982 intercepted_flags_ |= flag; |
| 3002 return true; | 2983 return true; |
| 3003 } | 2984 } |
| 3004 return false; | 2985 return false; |
| 3005 } | 2986 } |
| 3006 | 2987 |
| 3007 } // namespace internal | 2988 } // namespace internal |
| 3008 } // namespace v8 | 2989 } // namespace v8 |
| OLD | NEW |