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

Side by Side Diff: src/runtime.cc

Issue 258243003: Remove old-style accessor support from runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment 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/property.h ('k') | src/serialize.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 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 if (prototype->IsNull()) return isolate->heap()->false_value(); 1889 if (prototype->IsNull()) return isolate->heap()->false_value();
1890 if (*O == *prototype) return isolate->heap()->true_value(); 1890 if (*O == *prototype) return isolate->heap()->true_value();
1891 V = prototype; 1891 V = prototype;
1892 } 1892 }
1893 } 1893 }
1894 1894
1895 1895
1896 static bool CheckAccessException(Object* callback, 1896 static bool CheckAccessException(Object* callback,
1897 v8::AccessType access_type) { 1897 v8::AccessType access_type) {
1898 DisallowHeapAllocation no_gc; 1898 DisallowHeapAllocation no_gc;
1899 ASSERT(!callback->IsForeign());
1899 if (callback->IsAccessorInfo()) { 1900 if (callback->IsAccessorInfo()) {
1900 AccessorInfo* info = AccessorInfo::cast(callback); 1901 AccessorInfo* info = AccessorInfo::cast(callback);
1901 return 1902 return
1902 (access_type == v8::ACCESS_HAS && 1903 (access_type == v8::ACCESS_HAS &&
1903 (info->all_can_read() || info->all_can_write())) || 1904 (info->all_can_read() || info->all_can_write())) ||
1904 (access_type == v8::ACCESS_GET && info->all_can_read()) || 1905 (access_type == v8::ACCESS_GET && info->all_can_read()) ||
1905 (access_type == v8::ACCESS_SET && info->all_can_write()); 1906 (access_type == v8::ACCESS_SET && info->all_can_write());
1906 } 1907 }
1907 if (callback->IsAccessorPair()) { 1908 if (callback->IsAccessorPair()) {
1908 AccessorPair* info = AccessorPair::cast(callback); 1909 AccessorPair* info = AccessorPair::cast(callback);
(...skipping 3329 matching lines...) Expand 10 before | Expand all | Expand 10 after
5238 LookupResult lookup(isolate); 5239 LookupResult lookup(isolate);
5239 js_object->LocalLookupRealNamedProperty(*name, &lookup); 5240 js_object->LocalLookupRealNamedProperty(*name, &lookup);
5240 5241
5241 // Special case for callback properties. 5242 // Special case for callback properties.
5242 if (lookup.IsPropertyCallbacks()) { 5243 if (lookup.IsPropertyCallbacks()) {
5243 Handle<Object> callback(lookup.GetCallbackObject(), isolate); 5244 Handle<Object> callback(lookup.GetCallbackObject(), isolate);
5244 // Avoid redefining callback as data property, just use the stored 5245 // Avoid redefining callback as data property, just use the stored
5245 // setter to update the value instead. 5246 // setter to update the value instead.
5246 // TODO(mstarzinger): So far this only works if property attributes don't 5247 // TODO(mstarzinger): So far this only works if property attributes don't
5247 // change, this should be fixed once we cleanup the underlying code. 5248 // change, this should be fixed once we cleanup the underlying code.
5248 if ((callback->IsForeign() || callback->IsAccessorInfo()) && 5249 ASSERT(!callback->IsForeign());
5250 if (callback->IsAccessorInfo() &&
5249 lookup.GetAttributes() == attr) { 5251 lookup.GetAttributes() == attr) {
5250 Handle<Object> result_object; 5252 Handle<Object> result_object;
5251 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 5253 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
5252 isolate, result_object, 5254 isolate, result_object,
5253 JSObject::SetPropertyWithCallback(js_object, 5255 JSObject::SetPropertyWithCallback(js_object,
5254 callback, 5256 callback,
5255 name, 5257 name,
5256 obj_value, 5258 obj_value,
5257 handle(lookup.holder()), 5259 handle(lookup.holder()),
5258 STRICT)); 5260 STRICT));
(...skipping 5546 matching lines...) Expand 10 before | Expand all | Expand 10 after
10805 break; 10807 break;
10806 case FIELD: 10808 case FIELD:
10807 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), 10809 value = JSObject::FastPropertyAt(handle(result->holder(), isolate),
10808 result->representation(), 10810 result->representation(),
10809 result->GetFieldIndex().field_index()); 10811 result->GetFieldIndex().field_index());
10810 break; 10812 break;
10811 case CONSTANT: 10813 case CONSTANT:
10812 return handle(result->GetConstant(), isolate); 10814 return handle(result->GetConstant(), isolate);
10813 case CALLBACKS: { 10815 case CALLBACKS: {
10814 Handle<Object> structure(result->GetCallbackObject(), isolate); 10816 Handle<Object> structure(result->GetCallbackObject(), isolate);
10815 if (structure->IsForeign() || structure->IsAccessorInfo()) { 10817 ASSERT(!structure->IsForeign());
10818 if (structure->IsAccessorInfo()) {
10816 MaybeHandle<Object> obj = JSObject::GetPropertyWithCallback( 10819 MaybeHandle<Object> obj = JSObject::GetPropertyWithCallback(
10817 handle(result->holder(), isolate), receiver, structure, name); 10820 handle(result->holder(), isolate), receiver, structure, name);
10818 if (!obj.ToHandle(&value)) { 10821 if (!obj.ToHandle(&value)) {
10819 value = handle(isolate->pending_exception(), isolate); 10822 value = handle(isolate->pending_exception(), isolate);
10820 isolate->clear_pending_exception(); 10823 isolate->clear_pending_exception();
10821 if (has_caught != NULL) *has_caught = true; 10824 if (has_caught != NULL) *has_caught = true;
10822 return value; 10825 return value;
10823 } 10826 }
10824 } 10827 }
10825 break; 10828 break;
(...skipping 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after
15144 } 15147 }
15145 return NULL; 15148 return NULL;
15146 } 15149 }
15147 15150
15148 15151
15149 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15152 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15150 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15153 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15151 } 15154 }
15152 15155
15153 } } // namespace v8::internal 15156 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/property.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698