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

Side by Side Diff: src/accessors.cc

Issue 368783006: 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') | src/objects.cc » ('J')
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 // This means one of the object's prototypes is a JSArray and the 194 ASSERT(object->IsJSArray());
195 // object does not have a 'length' property. Calling SetProperty
196 // causes an infinite loop.
197 if (!object->IsJSArray()) {
198 MaybeHandle<Object> maybe_result =
199 JSObject::SetOwnPropertyIgnoreAttributes(
200 object, isolate->factory()->length_string(), value, NONE);
201 maybe_result.Check();
202 return;
203 }
204 195
205 value = FlattenNumber(isolate, value); 196 value = FlattenNumber(isolate, value);
206 197
207 Handle<JSArray> array_handle = Handle<JSArray>::cast(object); 198 Handle<JSArray> array_handle = Handle<JSArray>::cast(object);
208 MaybeHandle<Object> maybe; 199 MaybeHandle<Object> maybe;
209 Handle<Object> uint32_v; 200 Handle<Object> uint32_v;
210 maybe = Execution::ToUint32(isolate, value); 201 maybe = Execution::ToUint32(isolate, value);
211 if (!maybe.ToHandle(&uint32_v)) { 202 if (!maybe.ToHandle(&uint32_v)) {
212 isolate->OptionalRescheduleException(false); 203 isolate->OptionalRescheduleException(false);
213 return; 204 return;
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 Handle<JSObject> receiver, 855 Handle<JSObject> receiver,
865 Handle<Object> value) { 856 Handle<Object> value) {
866 Handle<JSFunction> function; 857 Handle<JSFunction> function;
867 { 858 {
868 DisallowHeapAllocation no_allocation; 859 DisallowHeapAllocation no_allocation;
869 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver); 860 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver);
870 if (function_raw == NULL) return isolate->factory()->undefined_value(); 861 if (function_raw == NULL) return isolate->factory()->undefined_value();
871 function = Handle<JSFunction>(function_raw, isolate); 862 function = Handle<JSFunction>(function_raw, isolate);
872 } 863 }
873 864
874 if (!function->should_have_prototype()) { 865 ASSERT(function->should_have_prototype());
875 // Since we hit this accessor, object will have no prototype property.
876 MaybeHandle<Object> maybe_result =
877 JSObject::SetOwnPropertyIgnoreAttributes(
878 receiver, isolate->factory()->prototype_string(), value, NONE);
879 return maybe_result.ToHandleChecked();
880 }
881 866
882 Handle<Object> old_value; 867 Handle<Object> old_value;
883 bool is_observed = *function == *receiver && function->map()->is_observed(); 868 bool is_observed = *function == *receiver && function->map()->is_observed();
884 if (is_observed) { 869 if (is_observed) {
885 if (function->has_prototype()) 870 if (function->has_prototype())
886 old_value = handle(function->prototype(), isolate); 871 old_value = handle(function->prototype(), isolate);
887 else 872 else
888 old_value = isolate->factory()->NewFunctionPrototype(function); 873 old_value = isolate->factory()->NewFunctionPrototype(function);
889 } 874 }
890 875
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 info->set_data(Smi::FromInt(index)); 1407 info->set_data(Smi::FromInt(index));
1423 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1408 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1424 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1409 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1425 info->set_getter(*getter); 1410 info->set_getter(*getter);
1426 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1411 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1427 return info; 1412 return info;
1428 } 1413 }
1429 1414
1430 1415
1431 } } // namespace v8::internal 1416 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698