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 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 } | 2473 } |
2474 accumulator->Add(" (SharedFunctionInfo %p)", | 2474 accumulator->Add(" (SharedFunctionInfo %p)", |
2475 reinterpret_cast<void*>(function->shared())); | 2475 reinterpret_cast<void*>(function->shared())); |
2476 accumulator->Put('>'); | 2476 accumulator->Put('>'); |
2477 break; | 2477 break; |
2478 } | 2478 } |
2479 case JS_GENERATOR_OBJECT_TYPE: { | 2479 case JS_GENERATOR_OBJECT_TYPE: { |
2480 accumulator->Add("<JS Generator>"); | 2480 accumulator->Add("<JS Generator>"); |
2481 break; | 2481 break; |
2482 } | 2482 } |
2483 case JS_MODULE_TYPE: { | |
2484 accumulator->Add("<JS Module>"); | |
2485 break; | |
2486 } | |
2487 // All other JSObjects are rather similar to each other (JSObject, | 2483 // All other JSObjects are rather similar to each other (JSObject, |
2488 // JSGlobalProxy, JSGlobalObject, JSUndetectable, JSValue). | 2484 // JSGlobalProxy, JSGlobalObject, JSUndetectable, JSValue). |
2489 default: { | 2485 default: { |
2490 Map* map_of_this = map(); | 2486 Map* map_of_this = map(); |
2491 Heap* heap = GetHeap(); | 2487 Heap* heap = GetHeap(); |
2492 Object* constructor = map_of_this->GetConstructor(); | 2488 Object* constructor = map_of_this->GetConstructor(); |
2493 bool printed = false; | 2489 bool printed = false; |
2494 if (constructor->IsHeapObject() && | 2490 if (constructor->IsHeapObject() && |
2495 !heap->Contains(HeapObject::cast(constructor))) { | 2491 !heap->Contains(HeapObject::cast(constructor))) { |
2496 accumulator->Add("!!!INVALID CONSTRUCTOR!!!"); | 2492 accumulator->Add("!!!INVALID CONSTRUCTOR!!!"); |
(...skipping 10231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12728 case JS_ARRAY_BUFFER_TYPE: | 12724 case JS_ARRAY_BUFFER_TYPE: |
12729 case JS_ARRAY_TYPE: | 12725 case JS_ARRAY_TYPE: |
12730 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 12726 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
12731 case JS_DATA_VIEW_TYPE: | 12727 case JS_DATA_VIEW_TYPE: |
12732 case JS_DATE_TYPE: | 12728 case JS_DATE_TYPE: |
12733 case JS_FUNCTION_TYPE: | 12729 case JS_FUNCTION_TYPE: |
12734 case JS_GENERATOR_OBJECT_TYPE: | 12730 case JS_GENERATOR_OBJECT_TYPE: |
12735 case JS_MAP_ITERATOR_TYPE: | 12731 case JS_MAP_ITERATOR_TYPE: |
12736 case JS_MAP_TYPE: | 12732 case JS_MAP_TYPE: |
12737 case JS_MESSAGE_OBJECT_TYPE: | 12733 case JS_MESSAGE_OBJECT_TYPE: |
12738 case JS_MODULE_TYPE: | |
12739 case JS_OBJECT_TYPE: | 12734 case JS_OBJECT_TYPE: |
12740 case JS_ERROR_TYPE: | 12735 case JS_ERROR_TYPE: |
12741 case JS_ARGUMENTS_TYPE: | 12736 case JS_ARGUMENTS_TYPE: |
12742 case JS_PROMISE_TYPE: | 12737 case JS_PROMISE_TYPE: |
12743 case JS_REGEXP_TYPE: | 12738 case JS_REGEXP_TYPE: |
12744 case JS_SET_ITERATOR_TYPE: | 12739 case JS_SET_ITERATOR_TYPE: |
12745 case JS_SET_TYPE: | 12740 case JS_SET_TYPE: |
12746 case JS_SPECIAL_API_OBJECT_TYPE: | 12741 case JS_SPECIAL_API_OBJECT_TYPE: |
12747 case JS_TYPED_ARRAY_TYPE: | 12742 case JS_TYPED_ARRAY_TYPE: |
12748 case JS_VALUE_TYPE: | 12743 case JS_VALUE_TYPE: |
(...skipping 6714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19463 | 19458 |
19464 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { | 19459 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { |
19465 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19460 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
19466 PrototypeIterator::END_AT_NULL); | 19461 PrototypeIterator::END_AT_NULL); |
19467 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19462 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
19468 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19463 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
19469 } | 19464 } |
19470 return false; | 19465 return false; |
19471 } | 19466 } |
19472 | 19467 |
19473 void JSModule::CreateExport(Handle<JSModule> module, Handle<String> name) { | 19468 void Module::CreateExport(Handle<Module> module, Handle<String> name) { |
19474 Isolate* isolate = module->GetIsolate(); | 19469 Isolate* isolate = module->GetIsolate(); |
19475 Handle<Cell> cell = | 19470 Handle<Cell> cell = |
19476 isolate->factory()->NewCell(isolate->factory()->undefined_value()); | 19471 isolate->factory()->NewCell(isolate->factory()->undefined_value()); |
19477 LookupIterator it(module, name); | 19472 Handle<ObjectHashTable> exports(module->exports(), isolate); |
19478 JSObject::CreateDataProperty(&it, cell, Object::THROW_ON_ERROR).ToChecked(); | 19473 DCHECK(exports->Lookup(name)->IsTheHole(isolate)); |
| 19474 exports = ObjectHashTable::Put(exports, name, cell); |
| 19475 module->set_exports(*exports); |
19479 } | 19476 } |
19480 | 19477 |
19481 void JSModule::StoreExport(Handle<JSModule> module, Handle<String> name, | 19478 void Module::StoreExport(Handle<Module> module, Handle<String> name, |
19482 Handle<Object> value) { | 19479 Handle<Object> value) { |
19483 LookupIterator it(module, name); | 19480 Handle<ObjectHashTable> exports(module->exports()); |
19484 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it)); | 19481 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); |
19485 cell->set_value(*value); | 19482 cell->set_value(*value); |
19486 } | 19483 } |
19487 | 19484 |
19488 Handle<Object> JSModule::LoadExport(Handle<JSModule> module, | 19485 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) { |
19489 Handle<String> name) { | |
19490 Isolate* isolate = module->GetIsolate(); | 19486 Isolate* isolate = module->GetIsolate(); |
19491 LookupIterator it(module, name); | 19487 Handle<ObjectHashTable> exports(module->exports(), isolate); |
19492 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it)); | 19488 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); |
19493 return handle(cell->value(), isolate); | 19489 return handle(cell->value(), isolate); |
19494 } | 19490 } |
19495 | 19491 |
19496 } // namespace internal | 19492 } // namespace internal |
19497 } // namespace v8 | 19493 } // namespace v8 |
OLD | NEW |