| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_ISOLATE_INL_H_ | 5 #ifndef V8_ISOLATE_INL_H_ |
| 6 #define V8_ISOLATE_INL_H_ | 6 #define V8_ISOLATE_INL_H_ |
| 7 | 7 |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 Handle<type> Isolate::name() { \ | 95 Handle<type> Isolate::name() { \ |
| 96 return Handle<type>(native_context()->name(), this); \ | 96 return Handle<type>(native_context()->name(), this); \ |
| 97 } \ | 97 } \ |
| 98 bool Isolate::is_##name(type* value) { \ | 98 bool Isolate::is_##name(type* value) { \ |
| 99 return native_context()->is_##name(value); \ | 99 return native_context()->is_##name(value); \ |
| 100 } | 100 } |
| 101 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) | 101 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) |
| 102 #undef NATIVE_CONTEXT_FIELD_ACCESSOR | 102 #undef NATIVE_CONTEXT_FIELD_ACCESSOR |
| 103 | 103 |
| 104 bool Isolate::IsArraySpeciesLookupChainIntact() { | 104 bool Isolate::IsArraySpeciesLookupChainIntact() { |
| 105 if (!FLAG_harmony_species) return true; | |
| 106 // Note: It would be nice to have debug checks to make sure that the | 105 // Note: It would be nice to have debug checks to make sure that the |
| 107 // species protector is accurate, but this would be hard to do for most of | 106 // species protector is accurate, but this would be hard to do for most of |
| 108 // what the protector stands for: | 107 // what the protector stands for: |
| 109 // - You'd need to traverse the heap to check that no Array instance has | 108 // - You'd need to traverse the heap to check that no Array instance has |
| 110 // a constructor property | 109 // a constructor property |
| 111 // - To check that Array[Symbol.species] == Array, JS code has to execute, | 110 // - To check that Array[Symbol.species] == Array, JS code has to execute, |
| 112 // but JS cannot be invoked in callstack overflow situations | 111 // but JS cannot be invoked in callstack overflow situations |
| 113 // All that could be checked reliably is that | 112 // All that could be checked reliably is that |
| 114 // Array.prototype.constructor == Array. Given that limitation, no check is | 113 // Array.prototype.constructor == Array. Given that limitation, no check is |
| 115 // done here. In place, there are mjsunit tests harmony/array-species* which | 114 // done here. In place, there are mjsunit tests harmony/array-species* which |
| 116 // ensure that behavior is correct in various invalid protector cases. | 115 // ensure that behavior is correct in various invalid protector cases. |
| 117 | 116 |
| 118 Cell* species_cell = heap()->species_protector(); | 117 Cell* species_cell = heap()->species_protector(); |
| 119 return species_cell->value()->IsSmi() && | 118 return species_cell->value()->IsSmi() && |
| 120 Smi::cast(species_cell->value())->value() == kArrayProtectorValid; | 119 Smi::cast(species_cell->value())->value() == kArrayProtectorValid; |
| 121 } | 120 } |
| 122 | 121 |
| 123 bool Isolate::IsHasInstanceLookupChainIntact() { | 122 bool Isolate::IsHasInstanceLookupChainIntact() { |
| 124 if (!FLAG_harmony_instanceof) return true; | |
| 125 PropertyCell* has_instance_cell = heap()->has_instance_protector(); | 123 PropertyCell* has_instance_cell = heap()->has_instance_protector(); |
| 126 return has_instance_cell->value() == Smi::FromInt(kArrayProtectorValid); | 124 return has_instance_cell->value() == Smi::FromInt(kArrayProtectorValid); |
| 127 } | 125 } |
| 128 | 126 |
| 129 } // namespace internal | 127 } // namespace internal |
| 130 } // namespace v8 | 128 } // namespace v8 |
| 131 | 129 |
| 132 #endif // V8_ISOLATE_INL_H_ | 130 #endif // V8_ISOLATE_INL_H_ |
| OLD | NEW |