| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2515 | 2515 |
| 2516 #ifdef DEBUG | 2516 #ifdef DEBUG |
| 2517 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2517 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2518 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2518 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2519 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2519 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2520 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2520 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2521 #undef ISOLATE_FIELD_OFFSET | 2521 #undef ISOLATE_FIELD_OFFSET |
| 2522 #endif | 2522 #endif |
| 2523 | 2523 |
| 2524 | 2524 |
| 2525 Handle<JSObject> Isolate::SetUpSubregistry(Handle<JSObject> registry, |
| 2526 Handle<Map> map, const char* cname) { |
| 2527 Handle<String> name = factory()->InternalizeUtf8String(cname); |
| 2528 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); |
| 2529 JSObject::NormalizeProperties(obj, CLEAR_INOBJECT_PROPERTIES, 0, |
| 2530 "SetupSymbolRegistry"); |
| 2531 JSObject::AddProperty(registry, name, obj, NONE); |
| 2532 return obj; |
| 2533 } |
| 2534 |
| 2535 |
| 2525 Handle<JSObject> Isolate::GetSymbolRegistry() { | 2536 Handle<JSObject> Isolate::GetSymbolRegistry() { |
| 2526 if (heap()->symbol_registry()->IsSmi()) { | 2537 if (heap()->symbol_registry()->IsSmi()) { |
| 2527 Handle<Map> map = factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 2538 Handle<Map> map = factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 2528 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map); | 2539 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map); |
| 2529 heap()->set_symbol_registry(*registry); | 2540 heap()->set_symbol_registry(*registry); |
| 2530 | 2541 |
| 2531 static const char* nested[] = {"for", "for_api", "keyFor", "private_api", | 2542 SetUpSubregistry(registry, map, "for"); |
| 2532 "private_intern"}; | 2543 SetUpSubregistry(registry, map, "for_api"); |
| 2533 for (unsigned i = 0; i < arraysize(nested); ++i) { | 2544 SetUpSubregistry(registry, map, "keyFor"); |
| 2534 Handle<String> name = factory()->InternalizeUtf8String(nested[i]); | 2545 SetUpSubregistry(registry, map, "private_api"); |
| 2535 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); | 2546 heap()->AddPrivateGlobalSymbols( |
| 2536 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8, | 2547 SetUpSubregistry(registry, map, "private_intern")); |
| 2537 "SetupSymbolRegistry"); | |
| 2538 JSObject::SetProperty(registry, name, obj, STRICT).Assert(); | |
| 2539 } | |
| 2540 } | 2548 } |
| 2541 return Handle<JSObject>::cast(factory()->symbol_registry()); | 2549 return Handle<JSObject>::cast(factory()->symbol_registry()); |
| 2542 } | 2550 } |
| 2543 | 2551 |
| 2544 | 2552 |
| 2545 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { | 2553 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { |
| 2546 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2554 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
| 2547 if (callback == call_completed_callbacks_.at(i)) return; | 2555 if (callback == call_completed_callbacks_.at(i)) return; |
| 2548 } | 2556 } |
| 2549 call_completed_callbacks_.Add(callback); | 2557 call_completed_callbacks_.Add(callback); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2785 if (prev_ && prev_->Intercept(flag)) return true; | 2793 if (prev_ && prev_->Intercept(flag)) return true; |
| 2786 // Then check whether this scope intercepts. | 2794 // Then check whether this scope intercepts. |
| 2787 if ((flag & intercept_mask_)) { | 2795 if ((flag & intercept_mask_)) { |
| 2788 intercepted_flags_ |= flag; | 2796 intercepted_flags_ |= flag; |
| 2789 return true; | 2797 return true; |
| 2790 } | 2798 } |
| 2791 return false; | 2799 return false; |
| 2792 } | 2800 } |
| 2793 | 2801 |
| 2794 } } // namespace v8::internal | 2802 } } // namespace v8::internal |
| OLD | NEW |