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 19562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19573 | 19573 |
19574 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { | 19574 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { |
19575 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19575 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
19576 PrototypeIterator::END_AT_NULL); | 19576 PrototypeIterator::END_AT_NULL); |
19577 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19577 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
19578 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19578 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
19579 } | 19579 } |
19580 return false; | 19580 return false; |
19581 } | 19581 } |
19582 | 19582 |
19583 void Module::CreateExport(Handle<Module> module, Handle<String> name) { | 19583 void Module::CreateExport(Handle<Module> module, Handle<FixedArray> names) { |
| 19584 DCHECK_LT(0, names->length()); |
19584 Isolate* isolate = module->GetIsolate(); | 19585 Isolate* isolate = module->GetIsolate(); |
19585 Handle<Cell> cell = | 19586 Handle<Cell> cell = |
19586 isolate->factory()->NewCell(isolate->factory()->undefined_value()); | 19587 isolate->factory()->NewCell(isolate->factory()->undefined_value()); |
19587 Handle<ObjectHashTable> exports(module->exports(), isolate); | 19588 Handle<ObjectHashTable> exports(module->exports(), isolate); |
19588 DCHECK(exports->Lookup(name)->IsTheHole(isolate)); | 19589 for (int i = 0, n = names->length(); i < n; ++i) { |
19589 exports = ObjectHashTable::Put(exports, name, cell); | 19590 Handle<String> name(String::cast(names->get(i)), isolate); |
| 19591 DCHECK(exports->Lookup(name)->IsTheHole(isolate)); |
| 19592 exports = ObjectHashTable::Put(exports, name, cell); |
| 19593 } |
19590 module->set_exports(*exports); | 19594 module->set_exports(*exports); |
19591 } | 19595 } |
19592 | 19596 |
19593 void Module::StoreExport(Handle<Module> module, Handle<String> name, | 19597 void Module::StoreExport(Handle<Module> module, Handle<String> name, |
19594 Handle<Object> value) { | 19598 Handle<Object> value) { |
19595 Handle<ObjectHashTable> exports(module->exports()); | 19599 Handle<ObjectHashTable> exports(module->exports()); |
19596 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); | 19600 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); |
19597 cell->set_value(*value); | 19601 cell->set_value(*value); |
19598 } | 19602 } |
19599 | 19603 |
19600 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) { | 19604 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) { |
19601 Isolate* isolate = module->GetIsolate(); | 19605 Isolate* isolate = module->GetIsolate(); |
19602 Handle<ObjectHashTable> exports(module->exports(), isolate); | 19606 Handle<ObjectHashTable> exports(module->exports(), isolate); |
19603 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); | 19607 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); |
19604 return handle(cell->value(), isolate); | 19608 return handle(cell->value(), isolate); |
19605 } | 19609 } |
19606 | 19610 |
19607 } // namespace internal | 19611 } // namespace internal |
19608 } // namespace v8 | 19612 } // namespace v8 |
OLD | NEW |