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

Side by Side Diff: src/api.cc

Issue 8914: Add support for API accessors that prohibit overwriting by accessors... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 HandleScope scope; 694 HandleScope scope;
695 i::Handle<i::AccessorInfo> obj = i::Factory::NewAccessorInfo(); 695 i::Handle<i::AccessorInfo> obj = i::Factory::NewAccessorInfo();
696 ASSERT(getter != NULL); 696 ASSERT(getter != NULL);
697 obj->set_getter(*FromCData(getter)); 697 obj->set_getter(*FromCData(getter));
698 obj->set_setter(*FromCData(setter)); 698 obj->set_setter(*FromCData(setter));
699 if (data.IsEmpty()) data = v8::Undefined(); 699 if (data.IsEmpty()) data = v8::Undefined();
700 obj->set_data(*Utils::OpenHandle(*data)); 700 obj->set_data(*Utils::OpenHandle(*data));
701 obj->set_name(*Utils::OpenHandle(*name)); 701 obj->set_name(*Utils::OpenHandle(*name));
702 if (settings & ALL_CAN_READ) obj->set_all_can_read(true); 702 if (settings & ALL_CAN_READ) obj->set_all_can_read(true);
703 if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true); 703 if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true);
704 if (settings & PROHIBITS_OVERWRITING) obj->set_prohibits_overwriting(true);
704 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes)); 705 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes));
705 706
706 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors()); 707 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors());
707 if (list->IsUndefined()) { 708 if (list->IsUndefined()) {
708 list = NeanderArray().value(); 709 list = NeanderArray().value();
709 Utils::OpenHandle(this)->set_property_accessors(*list); 710 Utils::OpenHandle(this)->set_property_accessors(*list);
710 } 711 }
711 NeanderArray array(list); 712 NeanderArray array(list);
712 array.add(obj); 713 array.add(obj);
713 } 714 }
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 1909
1909 // Turns on access checks by copying the map and setting the check flag. 1910 // Turns on access checks by copying the map and setting the check flag.
1910 // Because the object gets a new map, existing inline cache caching 1911 // Because the object gets a new map, existing inline cache caching
1911 // the old map of this object will fail. 1912 // the old map of this object will fail.
1912 void v8::Object::TurnOnAccessCheck() { 1913 void v8::Object::TurnOnAccessCheck() {
1913 ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return); 1914 ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return);
1914 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 1915 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
1915 1916
1916 i::Handle<i::Map> new_map = 1917 i::Handle<i::Map> new_map =
1917 i::Factory::CopyMapDropTransitions(i::Handle<i::Map>(obj->map())); 1918 i::Factory::CopyMapDropTransitions(i::Handle<i::Map>(obj->map()));
1918 new_map->set_is_access_check_needed(); 1919 new_map->set_is_access_check_needed(true);
1919 obj->set_map(*new_map); 1920 obj->set_map(*new_map);
1920 } 1921 }
1921 1922
1922 1923
1923 Local<v8::Object> Function::NewInstance() { 1924 Local<v8::Object> Function::NewInstance() {
1924 return NewInstance(0, NULL); 1925 return NewInstance(0, NULL);
1925 } 1926 }
1926 1927
1927 1928
1928 Local<v8::Object> Function::NewInstance(int argc, 1929 Local<v8::Object> Function::NewInstance(int argc,
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 reinterpret_cast<HandleScopeImplementer*>(storage); 2967 reinterpret_cast<HandleScopeImplementer*>(storage);
2967 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 2968 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
2968 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 2969 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
2969 &thread_local->handle_scope_data_; 2970 &thread_local->handle_scope_data_;
2970 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 2971 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
2971 2972
2972 return storage + ArchiveSpacePerThread(); 2973 return storage + ArchiveSpacePerThread();
2973 } 2974 }
2974 2975
2975 } } // namespace v8::internal 2976 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/apinatives.js » ('j') | src/apinatives.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698