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

Side by Side Diff: src/objects.cc

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: Disable module tests for deopt fuzzer. 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
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19452 matching lines...) Expand 10 before | Expand all | Expand 10 after
19463 19463
19464 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) { 19464 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) {
19465 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19465 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19466 PrototypeIterator::END_AT_NULL); 19466 PrototypeIterator::END_AT_NULL);
19467 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19467 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19468 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19468 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19469 } 19469 }
19470 return false; 19470 return false;
19471 } 19471 }
19472 19472
19473 void JSModule::CreateExport(Handle<JSModule> module, Handle<String> name) {
19474 Isolate* isolate = module->GetIsolate();
19475 Handle<Cell> cell =
19476 isolate->factory()->NewCell(isolate->factory()->undefined_value());
19477 LookupIterator it(module, name);
19478 JSObject::CreateDataProperty(&it, cell, Object::THROW_ON_ERROR).ToChecked();
19479 }
19480
19481 void JSModule::StoreExport(Handle<JSModule> module, Handle<String> name,
19482 Handle<Object> value) {
19483 LookupIterator it(module, name);
19484 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
19485 cell->set_value(*value);
19486 }
19487
19488 Handle<Object> JSModule::LoadExport(Handle<JSModule> module,
19489 Handle<String> name) {
19490 Isolate* isolate = module->GetIsolate();
19491 LookupIterator it(module, name);
19492 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
19493 return handle(cell->value(), isolate);
19494 }
19495
19473 } // namespace internal 19496 } // namespace internal
19474 } // namespace v8 19497 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698