OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 IllegalSetter, | 433 IllegalSetter, |
434 0 | 434 0 |
435 }; | 435 }; |
436 | 436 |
437 | 437 |
438 // | 438 // |
439 // Accessors::FunctionPrototype | 439 // Accessors::FunctionPrototype |
440 // | 440 // |
441 | 441 |
442 | 442 |
443 Handle<Object> Accessors::FunctionGetPrototype(Handle<Object> object) { | 443 Handle<Object> Accessors::FunctionGetPrototype(Handle<JSFunction> function) { |
444 Isolate* isolate = Isolate::Current(); | 444 CALL_HEAP_FUNCTION(function->GetIsolate(), |
445 CALL_HEAP_FUNCTION( | 445 Accessors::FunctionGetPrototype(*function, NULL), |
446 isolate, Accessors::FunctionGetPrototype(*object, 0), Object); | 446 Object); |
447 } | 447 } |
448 | 448 |
449 | 449 |
| 450 Handle<Object> Accessors::FunctionSetPrototype(Handle<JSFunction> function, |
| 451 Handle<Object> prototype) { |
| 452 ASSERT(function->should_have_prototype()); |
| 453 CALL_HEAP_FUNCTION(function->GetIsolate(), |
| 454 Accessors::FunctionSetPrototype(*function, |
| 455 *prototype, |
| 456 NULL), |
| 457 Object); |
| 458 } |
| 459 |
| 460 |
450 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) { | 461 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) { |
451 Isolate* isolate = Isolate::Current(); | 462 Isolate* isolate = Isolate::Current(); |
452 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, object); | 463 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, object); |
453 if (function_raw == NULL) return isolate->heap()->undefined_value(); | 464 if (function_raw == NULL) return isolate->heap()->undefined_value(); |
454 while (!function_raw->should_have_prototype()) { | 465 while (!function_raw->should_have_prototype()) { |
455 function_raw = FindInstanceOf<JSFunction>(isolate, | 466 function_raw = FindInstanceOf<JSFunction>(isolate, |
456 function_raw->GetPrototype()); | 467 function_raw->GetPrototype()); |
457 // There has to be one because we hit the getter. | 468 // There has to be one because we hit the getter. |
458 ASSERT(function_raw != NULL); | 469 ASSERT(function_raw != NULL); |
459 } | 470 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 ReadOnlySetAccessor, | 579 ReadOnlySetAccessor, |
569 0 | 580 0 |
570 }; | 581 }; |
571 | 582 |
572 | 583 |
573 // | 584 // |
574 // Accessors::FunctionArguments | 585 // Accessors::FunctionArguments |
575 // | 586 // |
576 | 587 |
577 | 588 |
578 Handle<Object> Accessors::FunctionGetArguments(Handle<Object> object) { | 589 Handle<Object> Accessors::FunctionGetArguments(Handle<JSFunction> function) { |
579 Isolate* isolate = Isolate::Current(); | 590 CALL_HEAP_FUNCTION(function->GetIsolate(), |
580 CALL_HEAP_FUNCTION( | 591 Accessors::FunctionGetArguments(*function, NULL), |
581 isolate, Accessors::FunctionGetArguments(*object, 0), Object); | 592 Object); |
582 } | 593 } |
583 | 594 |
584 | 595 |
585 static MaybeObject* ConstructArgumentsObjectForInlinedFunction( | 596 static MaybeObject* ConstructArgumentsObjectForInlinedFunction( |
586 JavaScriptFrame* frame, | 597 JavaScriptFrame* frame, |
587 Handle<JSFunction> inlined_function, | 598 Handle<JSFunction> inlined_function, |
588 int inlined_frame_index) { | 599 int inlined_frame_index) { |
589 Isolate* isolate = inlined_function->GetIsolate(); | 600 Isolate* isolate = inlined_function->GetIsolate(); |
590 Factory* factory = isolate->factory(); | 601 Factory* factory = isolate->factory(); |
591 Vector<SlotRef> args_slots = | 602 Vector<SlotRef> args_slots = |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 info->set_data(Smi::FromInt(index)); | 859 info->set_data(Smi::FromInt(index)); |
849 Handle<Object> getter = v8::FromCData(&ModuleGetExport); | 860 Handle<Object> getter = v8::FromCData(&ModuleGetExport); |
850 Handle<Object> setter = v8::FromCData(&ModuleSetExport); | 861 Handle<Object> setter = v8::FromCData(&ModuleSetExport); |
851 info->set_getter(*getter); | 862 info->set_getter(*getter); |
852 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 863 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
853 return info; | 864 return info; |
854 } | 865 } |
855 | 866 |
856 | 867 |
857 } } // namespace v8::internal | 868 } } // namespace v8::internal |
OLD | NEW |