Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: src/objects.cc

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19325 matching lines...) Expand 10 before | Expand all | Expand 10 after
19336 19336
19337 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { 19337 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) {
19338 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19338 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19339 PrototypeIterator::END_AT_NULL); 19339 PrototypeIterator::END_AT_NULL);
19340 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19340 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19341 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19341 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19342 } 19342 }
19343 return false; 19343 return false;
19344 } 19344 }
19345 19345
19346 void JSModule::CreateExport(Handle<JSModule> module, Handle<String> name) {
19347 Isolate* isolate = module->GetIsolate();
19348 Handle<Cell> cell =
19349 isolate->factory()->NewCell(isolate->factory()->undefined_value());
19350 LookupIterator it(module, name);
19351 JSObject::CreateDataProperty(&it, cell, Object::THROW_ON_ERROR).ToChecked();
19352 }
19353
19354 void JSModule::StoreExport(Handle<JSModule> module,
19355 Handle<String> name, Handle<Object> value) {
19356 LookupIterator it(module, name);
19357 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
19358 cell->set_value(*value);
19359 }
19360
19361 Handle<Object> JSModule::LoadExport(Handle<JSModule> module,
19362 Handle<String> name) {
19363 Isolate* isolate = module->GetIsolate();
19364 LookupIterator it(module, name);
19365 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
19366 return handle(cell->value(), isolate);
19367 }
19368
19346 } // namespace internal 19369 } // namespace internal
19347 } // namespace v8 19370 } // namespace v8
OLDNEW
« src/interpreter/bytecode-generator.cc ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698