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 19418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19429 | 19429 |
19430 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { | 19430 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { |
19431 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19431 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
19432 PrototypeIterator::END_AT_NULL); | 19432 PrototypeIterator::END_AT_NULL); |
19433 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19433 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
19434 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19434 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
19435 } | 19435 } |
19436 return false; | 19436 return false; |
19437 } | 19437 } |
19438 | 19438 |
| 19439 void JSModule::CreateExport(Handle<JSModule> module, Handle<String> name) { |
| 19440 Isolate* isolate = module->GetIsolate(); |
| 19441 Handle<Cell> cell = |
| 19442 isolate->factory()->NewCell(isolate->factory()->undefined_value()); |
| 19443 LookupIterator it(module, name); |
| 19444 JSObject::CreateDataProperty(&it, cell, Object::THROW_ON_ERROR).ToChecked(); |
| 19445 } |
| 19446 |
| 19447 void JSModule::StoreExport(Handle<JSModule> module, Handle<String> name, |
| 19448 Handle<Object> value) { |
| 19449 LookupIterator it(module, name); |
| 19450 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it)); |
| 19451 cell->set_value(*value); |
| 19452 } |
| 19453 |
| 19454 Handle<Object> JSModule::LoadExport(Handle<JSModule> module, |
| 19455 Handle<String> name) { |
| 19456 Isolate* isolate = module->GetIsolate(); |
| 19457 LookupIterator it(module, name); |
| 19458 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it)); |
| 19459 return handle(cell->value(), isolate); |
| 19460 } |
| 19461 |
19439 } // namespace internal | 19462 } // namespace internal |
19440 } // namespace v8 | 19463 } // namespace v8 |
OLD | NEW |