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

Side by Side Diff: src/bootstrapper.cc

Issue 256803010: Convert function.caller to API-style accessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: disable read/write access Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "bootstrapper.h" 5 #include "bootstrapper.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "natives.h" 9 #include "natives.h"
10 #include "snapshot.h" 10 #include "snapshot.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 function->shared()->set_native(true); 381 function->shared()->set_native(true);
382 return function; 382 return function;
383 } 383 }
384 384
385 385
386 void Genesis::SetFunctionInstanceDescriptor( 386 void Genesis::SetFunctionInstanceDescriptor(
387 Handle<Map> map, PrototypePropertyMode prototypeMode) { 387 Handle<Map> map, PrototypePropertyMode prototypeMode) {
388 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 388 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
389 Map::EnsureDescriptorSlack(map, size); 389 Map::EnsureDescriptorSlack(map, size);
390 390
391 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller));
392 PropertyAttributes attribs = static_cast<PropertyAttributes>( 391 PropertyAttributes attribs = static_cast<PropertyAttributes>(
393 DONT_ENUM | DONT_DELETE | READ_ONLY); 392 DONT_ENUM | DONT_DELETE | READ_ONLY);
394 393
395 Handle<AccessorInfo> length = 394 Handle<AccessorInfo> length =
396 Accessors::FunctionLengthInfo(isolate(), attribs); 395 Accessors::FunctionLengthInfo(isolate(), attribs);
397 { // Add length. 396 { // Add length.
398 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), 397 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
399 length, attribs); 398 length, attribs);
400 map->AppendDescriptor(&d); 399 map->AppendDescriptor(&d);
401 } 400 }
402 Handle<AccessorInfo> name = 401 Handle<AccessorInfo> name =
403 Accessors::FunctionNameInfo(isolate(), attribs); 402 Accessors::FunctionNameInfo(isolate(), attribs);
404 { // Add name. 403 { // Add name.
405 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), 404 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
406 name, attribs); 405 name, attribs);
407 map->AppendDescriptor(&d); 406 map->AppendDescriptor(&d);
408 } 407 }
409 Handle<AccessorInfo> args = 408 Handle<AccessorInfo> args =
410 Accessors::FunctionArgumentsInfo(isolate(), attribs); 409 Accessors::FunctionArgumentsInfo(isolate(), attribs);
411 { // Add arguments. 410 { // Add arguments.
412 CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())), 411 CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())),
413 args, attribs); 412 args, attribs);
414 map->AppendDescriptor(&d); 413 map->AppendDescriptor(&d);
415 } 414 }
415 Handle<AccessorInfo> caller =
416 Accessors::FunctionCallerInfo(isolate(), attribs);
416 { // Add caller. 417 { // Add caller.
417 CallbacksDescriptor d(factory()->caller_string(), caller, attribs); 418 CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())),
419 caller, attribs);
418 map->AppendDescriptor(&d); 420 map->AppendDescriptor(&d);
419 } 421 }
420 if (prototypeMode != DONT_ADD_PROTOTYPE) { 422 if (prototypeMode != DONT_ADD_PROTOTYPE) {
421 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { 423 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
422 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); 424 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY);
423 } 425 }
424 Handle<AccessorInfo> prototype = 426 Handle<AccessorInfo> prototype =
425 Accessors::FunctionPrototypeInfo(isolate(), attribs); 427 Accessors::FunctionPrototypeInfo(isolate(), attribs);
426 CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), 428 CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())),
427 prototype, attribs); 429 prototype, attribs);
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 return from + sizeof(NestingCounterType); 2688 return from + sizeof(NestingCounterType);
2687 } 2689 }
2688 2690
2689 2691
2690 // Called when the top-level V8 mutex is destroyed. 2692 // Called when the top-level V8 mutex is destroyed.
2691 void Bootstrapper::FreeThreadResources() { 2693 void Bootstrapper::FreeThreadResources() {
2692 ASSERT(!IsActive()); 2694 ASSERT(!IsActive());
2693 } 2695 }
2694 2696
2695 } } // namespace v8::internal 2697 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698