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

Side by Side Diff: src/accessors.cc

Issue 2410823002: [modules] Simplify installation of @@toStringTag on namespace objects. (Closed)
Patch Set: Created 4 years, 2 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/accessors.h ('k') | src/bootstrapper.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/accessors.h" 5 #include "src/accessors.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/contexts.h" 8 #include "src/contexts.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Handle<AccessorInfo> Accessors::ArrayLengthInfo( 196 Handle<AccessorInfo> Accessors::ArrayLengthInfo(
197 Isolate* isolate, PropertyAttributes attributes) { 197 Isolate* isolate, PropertyAttributes attributes) {
198 return MakeAccessor(isolate, 198 return MakeAccessor(isolate,
199 isolate->factory()->length_string(), 199 isolate->factory()->length_string(),
200 &ArrayLengthGetter, 200 &ArrayLengthGetter,
201 &ArrayLengthSetter, 201 &ArrayLengthSetter,
202 attributes); 202 attributes);
203 } 203 }
204 204
205 // 205 //
206 // Accessors::ModuleNamespaceToStringTag
207 //
208
209 void Accessors::ModuleNamespaceToStringTagGetter(
210 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
211 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
212 info.GetReturnValue().Set(
213 Utils::ToLocal(isolate->factory()->NewStringFromAsciiChecked("Module")));
214 }
215
216 Handle<AccessorInfo> Accessors::ModuleNamespaceToStringTagInfo(
217 Isolate* isolate, PropertyAttributes attributes) {
218 Handle<Name> name = isolate->factory()->to_string_tag_symbol();
219 return MakeAccessor(isolate, name, &ModuleNamespaceToStringTagGetter, nullptr,
220 attributes);
221 }
222
223 //
224 // Accessors::ModuleNamespaceEntry 206 // Accessors::ModuleNamespaceEntry
225 // 207 //
226 208
227 void Accessors::ModuleNamespaceEntryGetter( 209 void Accessors::ModuleNamespaceEntryGetter(
228 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { 210 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
229 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 211 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
230 HandleScope scope(isolate); 212 HandleScope scope(isolate);
231 JSModuleNamespace* holder = 213 JSModuleNamespace* holder =
232 JSModuleNamespace::cast(*Utils::OpenHandle(*info.Holder())); 214 JSModuleNamespace::cast(*Utils::OpenHandle(*info.Holder()));
233 Handle<Object> result; 215 Handle<Object> result;
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 Handle<AccessorInfo> Accessors::ErrorStackInfo(Isolate* isolate, 1271 Handle<AccessorInfo> Accessors::ErrorStackInfo(Isolate* isolate,
1290 PropertyAttributes attributes) { 1272 PropertyAttributes attributes) {
1291 Handle<AccessorInfo> info = 1273 Handle<AccessorInfo> info =
1292 MakeAccessor(isolate, isolate->factory()->stack_string(), 1274 MakeAccessor(isolate, isolate->factory()->stack_string(),
1293 &ErrorStackGetter, &ErrorStackSetter, attributes); 1275 &ErrorStackGetter, &ErrorStackSetter, attributes);
1294 return info; 1276 return info;
1295 } 1277 }
1296 1278
1297 } // namespace internal 1279 } // namespace internal
1298 } // namespace v8 1280 } // namespace v8
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698