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

Side by Side Diff: src/accessors.cc

Issue 378583002: Revert "Treat ExecutableAccessorInfo as regular data properties." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/ic.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 // 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 void Accessors::ArrayLengthSetter( 185 void Accessors::ArrayLengthSetter(
186 v8::Local<v8::String> name, 186 v8::Local<v8::String> name,
187 v8::Local<v8::Value> val, 187 v8::Local<v8::Value> val,
188 const v8::PropertyCallbackInfo<void>& info) { 188 const v8::PropertyCallbackInfo<void>& info) {
189 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 189 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
190 HandleScope scope(isolate); 190 HandleScope scope(isolate);
191 Handle<JSObject> object = Handle<JSObject>::cast( 191 Handle<JSObject> object = Handle<JSObject>::cast(
192 Utils::OpenHandle(*info.This())); 192 Utils::OpenHandle(*info.This()));
193 Handle<Object> value = Utils::OpenHandle(*val); 193 Handle<Object> value = Utils::OpenHandle(*val);
194 ASSERT(object->IsJSArray()); 194 // This means one of the object's prototypes is a JSArray and the
195 // object does not have a 'length' property. Calling SetProperty
196 // causes an infinite loop.
197 if (!object->IsJSArray()) {
198 MaybeHandle<Object> maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
199 object, isolate->factory()->length_string(), value, NONE);
200 maybe_result.Check();
201 return;
202 }
195 203
196 value = FlattenNumber(isolate, value); 204 value = FlattenNumber(isolate, value);
197 205
198 Handle<JSArray> array_handle = Handle<JSArray>::cast(object); 206 Handle<JSArray> array_handle = Handle<JSArray>::cast(object);
199 MaybeHandle<Object> maybe; 207 MaybeHandle<Object> maybe;
200 Handle<Object> uint32_v; 208 Handle<Object> uint32_v;
201 maybe = Execution::ToUint32(isolate, value); 209 maybe = Execution::ToUint32(isolate, value);
202 if (!maybe.ToHandle(&uint32_v)) { 210 if (!maybe.ToHandle(&uint32_v)) {
203 isolate->OptionalRescheduleException(false); 211 isolate->OptionalRescheduleException(false);
204 return; 212 return;
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 Handle<JSObject> receiver, 863 Handle<JSObject> receiver,
856 Handle<Object> value) { 864 Handle<Object> value) {
857 Handle<JSFunction> function; 865 Handle<JSFunction> function;
858 { 866 {
859 DisallowHeapAllocation no_allocation; 867 DisallowHeapAllocation no_allocation;
860 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver); 868 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver);
861 if (function_raw == NULL) return isolate->factory()->undefined_value(); 869 if (function_raw == NULL) return isolate->factory()->undefined_value();
862 function = Handle<JSFunction>(function_raw, isolate); 870 function = Handle<JSFunction>(function_raw, isolate);
863 } 871 }
864 872
865 ASSERT(function->should_have_prototype()); 873 if (!function->should_have_prototype()) {
874 // Since we hit this accessor, object will have no prototype property.
875 MaybeHandle<Object> maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
876 receiver, isolate->factory()->prototype_string(), value, NONE);
877 return maybe_result.ToHandleChecked();
878 }
866 879
867 Handle<Object> old_value; 880 Handle<Object> old_value;
868 bool is_observed = *function == *receiver && function->map()->is_observed(); 881 bool is_observed = *function == *receiver && function->map()->is_observed();
869 if (is_observed) { 882 if (is_observed) {
870 if (function->has_prototype()) 883 if (function->has_prototype())
871 old_value = handle(function->prototype(), isolate); 884 old_value = handle(function->prototype(), isolate);
872 else 885 else
873 old_value = isolate->factory()->NewFunctionPrototype(function); 886 old_value = isolate->factory()->NewFunctionPrototype(function);
874 } 887 }
875 888
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 info->set_data(Smi::FromInt(index)); 1420 info->set_data(Smi::FromInt(index));
1408 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1421 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1409 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1422 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1410 info->set_getter(*getter); 1423 info->set_getter(*getter);
1411 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1424 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1412 return info; 1425 return info;
1413 } 1426 }
1414 1427
1415 1428
1416 } } // namespace v8::internal 1429 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698