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 20292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20303 FetchStarExports(module, &zone, &visited); | 20303 FetchStarExports(module, &zone, &visited); |
20304 Handle<ObjectHashTable> exports(module->exports(), isolate); | 20304 Handle<ObjectHashTable> exports(module->exports(), isolate); |
20305 ZoneVector<Handle<String>> names(&zone); | 20305 ZoneVector<Handle<String>> names(&zone); |
20306 names.reserve(exports->NumberOfElements()); | 20306 names.reserve(exports->NumberOfElements()); |
20307 for (int i = 0, n = exports->Capacity(); i < n; ++i) { | 20307 for (int i = 0, n = exports->Capacity(); i < n; ++i) { |
20308 Handle<Object> key(exports->KeyAt(i), isolate); | 20308 Handle<Object> key(exports->KeyAt(i), isolate); |
20309 if (!exports->IsKey(isolate, *key)) continue; | 20309 if (!exports->IsKey(isolate, *key)) continue; |
20310 DCHECK(exports->ValueAt(i)->IsCell()); | 20310 DCHECK(exports->ValueAt(i)->IsCell()); |
20311 names.push_back(Handle<String>::cast(key)); | 20311 names.push_back(Handle<String>::cast(key)); |
20312 } | 20312 } |
20313 DCHECK_EQ(names.size(), exports->NumberOfElements()); | 20313 DCHECK_EQ(static_cast<int>(names.size()), exports->NumberOfElements()); |
20314 | 20314 |
20315 // Sort them alphabetically. | 20315 // Sort them alphabetically. |
20316 struct { | 20316 struct { |
20317 bool operator()(Handle<String> a, Handle<String> b) { | 20317 bool operator()(Handle<String> a, Handle<String> b) { |
20318 return String::Compare(a, b) == ComparisonResult::kLessThan; | 20318 return String::Compare(a, b) == ComparisonResult::kLessThan; |
20319 } | 20319 } |
20320 } StringLess; | 20320 } StringLess; |
20321 std::sort(names.begin(), names.end(), StringLess); | 20321 std::sort(names.begin(), names.end(), StringLess); |
20322 | 20322 |
20323 // Create the corresponding properties in the namespace object. | 20323 // Create the corresponding properties in the namespace object. |
(...skipping 16 matching lines...) Expand all Loading... |
20340 // Check if the accessor uses a cached property. | 20340 // Check if the accessor uses a cached property. |
20341 if (!fti->cached_property_name()->IsTheHole(isolate)) { | 20341 if (!fti->cached_property_name()->IsTheHole(isolate)) { |
20342 return handle(Name::cast(fti->cached_property_name())); | 20342 return handle(Name::cast(fti->cached_property_name())); |
20343 } | 20343 } |
20344 } | 20344 } |
20345 return MaybeHandle<Name>(); | 20345 return MaybeHandle<Name>(); |
20346 } | 20346 } |
20347 | 20347 |
20348 } // namespace internal | 20348 } // namespace internal |
20349 } // namespace v8 | 20349 } // namespace v8 |
OLD | NEW |