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

Side by Side Diff: src/accessors.cc

Issue 12300018: Made Isolate a mandatory parameter for everything Handle-related. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed CreateCode calls. Be nicer to MIPS. Created 7 years, 10 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 | « no previous file | src/api.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 // 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 // 567 //
568 // Accessors::FunctionArguments 568 // Accessors::FunctionArguments
569 // 569 //
570 570
571 571
572 static MaybeObject* ConstructArgumentsObjectForInlinedFunction( 572 static MaybeObject* ConstructArgumentsObjectForInlinedFunction(
573 JavaScriptFrame* frame, 573 JavaScriptFrame* frame,
574 Handle<JSFunction> inlined_function, 574 Handle<JSFunction> inlined_function,
575 int inlined_frame_index) { 575 int inlined_frame_index) {
576 Factory* factory = Isolate::Current()->factory(); 576 Isolate* isolate = inlined_function->GetIsolate();
577 Factory* factory = isolate->factory();
577 Vector<SlotRef> args_slots = 578 Vector<SlotRef> args_slots =
578 SlotRef::ComputeSlotMappingForArguments( 579 SlotRef::ComputeSlotMappingForArguments(
579 frame, 580 frame,
580 inlined_frame_index, 581 inlined_frame_index,
581 inlined_function->shared()->formal_parameter_count()); 582 inlined_function->shared()->formal_parameter_count());
582 int args_count = args_slots.length(); 583 int args_count = args_slots.length();
583 Handle<JSObject> arguments = 584 Handle<JSObject> arguments =
584 factory->NewArgumentsObject(inlined_function, args_count); 585 factory->NewArgumentsObject(inlined_function, args_count);
585 Handle<FixedArray> array = factory->NewFixedArray(args_count); 586 Handle<FixedArray> array = factory->NewFixedArray(args_count);
586 for (int i = 0; i < args_count; ++i) { 587 for (int i = 0; i < args_count; ++i) {
587 Handle<Object> value = args_slots[i].GetValue(); 588 Handle<Object> value = args_slots[i].GetValue(isolate);
588 array->set(i, *value); 589 array->set(i, *value);
589 } 590 }
590 arguments->set_elements(*array); 591 arguments->set_elements(*array);
591 args_slots.Dispose(); 592 args_slots.Dispose();
592 593
593 // Return the freshly allocated arguments object. 594 // Return the freshly allocated arguments object.
594 return *arguments; 595 return *arguments;
595 } 596 }
596 597
597 598
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 Object* value_raw, 801 Object* value_raw,
801 void*) { 802 void*) {
802 const bool kSkipHiddenPrototypes = true; 803 const bool kSkipHiddenPrototypes = true;
803 // To be consistent with other Set functions, return the value. 804 // To be consistent with other Set functions, return the value.
804 if (!(FLAG_harmony_observation && receiver_raw->map()->is_observed())) 805 if (!(FLAG_harmony_observation && receiver_raw->map()->is_observed()))
805 return receiver_raw->SetPrototype(value_raw, kSkipHiddenPrototypes); 806 return receiver_raw->SetPrototype(value_raw, kSkipHiddenPrototypes);
806 807
807 Isolate* isolate = receiver_raw->GetIsolate(); 808 Isolate* isolate = receiver_raw->GetIsolate();
808 HandleScope scope(isolate); 809 HandleScope scope(isolate);
809 Handle<JSObject> receiver(receiver_raw); 810 Handle<JSObject> receiver(receiver_raw);
810 Handle<Object> value(value_raw); 811 Handle<Object> value(value_raw, isolate);
811 Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(*receiver)); 812 Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(*receiver),
813 isolate);
812 814
813 MaybeObject* result = receiver->SetPrototype(*value, kSkipHiddenPrototypes); 815 MaybeObject* result = receiver->SetPrototype(*value, kSkipHiddenPrototypes);
814 Handle<Object> hresult; 816 Handle<Object> hresult;
815 if (!result->ToHandle(&hresult, isolate)) return result; 817 if (!result->ToHandle(&hresult, isolate)) return result;
816 818
817 Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(*receiver)); 819 Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(*receiver),
820 isolate);
818 if (!new_value->SameValue(*old_value)) { 821 if (!new_value->SameValue(*old_value)) {
819 JSObject::EnqueueChangeRecord(receiver, "prototype", 822 JSObject::EnqueueChangeRecord(receiver, "prototype",
820 isolate->factory()->Proto_symbol(), 823 isolate->factory()->Proto_symbol(),
821 old_value); 824 old_value);
822 } 825 }
823 return *hresult; 826 return *hresult;
824 } 827 }
825 828
826 829
827 const AccessorDescriptor Accessors::ObjectPrototype = { 830 const AccessorDescriptor Accessors::ObjectPrototype = {
828 ObjectGetPrototype, 831 ObjectGetPrototype,
829 ObjectSetPrototype, 832 ObjectSetPrototype,
830 0 833 0
831 }; 834 };
832 835
833 836
834 // 837 //
835 // Accessors::MakeModuleExport 838 // Accessors::MakeModuleExport
836 // 839 //
837 840
838 static v8::Handle<v8::Value> ModuleGetExport( 841 static v8::Handle<v8::Value> ModuleGetExport(
839 v8::Local<v8::String> property, 842 v8::Local<v8::String> property,
840 const v8::AccessorInfo& info) { 843 const v8::AccessorInfo& info) {
841 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); 844 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder()));
842 Context* context = Context::cast(instance->context()); 845 Context* context = Context::cast(instance->context());
843 ASSERT(context->IsModuleContext()); 846 ASSERT(context->IsModuleContext());
844 int slot = info.Data()->Int32Value(); 847 int slot = info.Data()->Int32Value();
845 Object* value = context->get(slot); 848 Object* value = context->get(slot);
849 Isolate* isolate = instance->GetIsolate();
846 if (value->IsTheHole()) { 850 if (value->IsTheHole()) {
847 Handle<String> name = v8::Utils::OpenHandle(*property); 851 Handle<String> name = v8::Utils::OpenHandle(*property);
848 Isolate* isolate = instance->GetIsolate();
849 isolate->ScheduleThrow( 852 isolate->ScheduleThrow(
850 *isolate->factory()->NewReferenceError("not_defined", 853 *isolate->factory()->NewReferenceError("not_defined",
851 HandleVector(&name, 1))); 854 HandleVector(&name, 1)));
852 return v8::Handle<v8::Value>(); 855 return v8::Handle<v8::Value>();
853 } 856 }
854 return v8::Utils::ToLocal(Handle<Object>(value)); 857 return v8::Utils::ToLocal(Handle<Object>(value, isolate));
855 } 858 }
856 859
857 860
858 static void ModuleSetExport( 861 static void ModuleSetExport(
859 v8::Local<v8::String> property, 862 v8::Local<v8::String> property,
860 v8::Local<v8::Value> value, 863 v8::Local<v8::Value> value,
861 const v8::AccessorInfo& info) { 864 const v8::AccessorInfo& info) {
862 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); 865 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder()));
863 Context* context = Context::cast(instance->context()); 866 Context* context = Context::cast(instance->context());
864 ASSERT(context->IsModuleContext()); 867 ASSERT(context->IsModuleContext());
(...skipping 24 matching lines...) Expand all
889 info->set_data(Smi::FromInt(index)); 892 info->set_data(Smi::FromInt(index));
890 Handle<Object> getter = v8::FromCData(&ModuleGetExport); 893 Handle<Object> getter = v8::FromCData(&ModuleGetExport);
891 Handle<Object> setter = v8::FromCData(&ModuleSetExport); 894 Handle<Object> setter = v8::FromCData(&ModuleSetExport);
892 info->set_getter(*getter); 895 info->set_getter(*getter);
893 if (!(attributes & ReadOnly)) info->set_setter(*setter); 896 if (!(attributes & ReadOnly)) info->set_setter(*setter);
894 return info; 897 return info;
895 } 898 }
896 899
897 900
898 } } // namespace v8::internal 901 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698