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

Side by Side Diff: src/accessors.cc

Issue 653593002: Catch exceptions thrown when enqueuing change records. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 2 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/accessors.h ('k') | src/bootstrapper.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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 165 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
166 HandleScope scope(isolate); 166 HandleScope scope(isolate);
167 Handle<JSObject> object = Utils::OpenHandle(*info.This()); 167 Handle<JSObject> object = Utils::OpenHandle(*info.This());
168 Handle<Object> value = Utils::OpenHandle(*val); 168 Handle<Object> value = Utils::OpenHandle(*val);
169 169
170 if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return; 170 if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return;
171 171
172 LookupIterator it(object, Utils::OpenHandle(*name)); 172 LookupIterator it(object, Utils::OpenHandle(*name));
173 CHECK_EQ(LookupIterator::ACCESSOR, it.state()); 173 CHECK_EQ(LookupIterator::ACCESSOR, it.state());
174 DCHECK(it.HolderIsReceiverOrHiddenPrototype()); 174 DCHECK(it.HolderIsReceiverOrHiddenPrototype());
175 Object::SetDataProperty(&it, value); 175
176 if (Object::SetDataProperty(&it, value).is_null()) {
177 isolate->OptionalRescheduleException(false);
178 }
176 } 179 }
177 180
178 181
179 Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo( 182 Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo(
180 Isolate* isolate, PropertyAttributes attributes) { 183 Isolate* isolate, PropertyAttributes attributes) {
181 Handle<Name> name(isolate->native_context()->iterator_symbol(), isolate); 184 Handle<Name> name(isolate->native_context()->iterator_symbol(), isolate);
182 return MakeAccessor(isolate, name, &ArgumentsIteratorGetter, 185 return MakeAccessor(isolate, name, &ArgumentsIteratorGetter,
183 &ArgumentsIteratorSetter, attributes); 186 &ArgumentsIteratorSetter, attributes);
184 } 187 }
185 188
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 243 }
241 Handle<Object> number_v; 244 Handle<Object> number_v;
242 maybe = Execution::ToNumber(isolate, value); 245 maybe = Execution::ToNumber(isolate, value);
243 if (!maybe.ToHandle(&number_v)) { 246 if (!maybe.ToHandle(&number_v)) {
244 isolate->OptionalRescheduleException(false); 247 isolate->OptionalRescheduleException(false);
245 return; 248 return;
246 } 249 }
247 250
248 if (uint32_v->Number() == number_v->Number()) { 251 if (uint32_v->Number() == number_v->Number()) {
249 maybe = JSArray::SetElementsLength(array_handle, uint32_v); 252 maybe = JSArray::SetElementsLength(array_handle, uint32_v);
250 maybe.Check(); 253 if (maybe.is_null()) isolate->OptionalRescheduleException(false);
251 return; 254 return;
252 } 255 }
253 256
254 Handle<Object> exception; 257 Handle<Object> exception;
255 maybe = isolate->factory()->NewRangeError("invalid_array_length", 258 maybe = isolate->factory()->NewRangeError("invalid_array_length",
256 HandleVector<Object>(NULL, 0)); 259 HandleVector<Object>(NULL, 0));
257 if (!maybe.ToHandle(&exception)) { 260 if (!maybe.ToHandle(&exception)) {
258 isolate->OptionalRescheduleException(false); 261 isolate->OptionalRescheduleException(false);
259 return; 262 return;
260 } 263 }
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 static Handle<Object> GetFunctionPrototype(Isolate* isolate, 877 static Handle<Object> GetFunctionPrototype(Isolate* isolate,
875 Handle<JSFunction> function) { 878 Handle<JSFunction> function) {
876 if (!function->has_prototype()) { 879 if (!function->has_prototype()) {
877 Handle<Object> proto = isolate->factory()->NewFunctionPrototype(function); 880 Handle<Object> proto = isolate->factory()->NewFunctionPrototype(function);
878 JSFunction::SetPrototype(function, proto); 881 JSFunction::SetPrototype(function, proto);
879 } 882 }
880 return Handle<Object>(function->prototype(), isolate); 883 return Handle<Object>(function->prototype(), isolate);
881 } 884 }
882 885
883 886
884 static Handle<Object> SetFunctionPrototype(Isolate* isolate, 887 MUST_USE_RESULT static MaybeHandle<Object> SetFunctionPrototype(
885 Handle<JSFunction> function, 888 Isolate* isolate, Handle<JSFunction> function, Handle<Object> value) {
886 Handle<Object> value) {
887 Handle<Object> old_value; 889 Handle<Object> old_value;
888 bool is_observed = function->map()->is_observed(); 890 bool is_observed = function->map()->is_observed();
889 if (is_observed) { 891 if (is_observed) {
890 if (function->has_prototype()) 892 if (function->has_prototype())
891 old_value = handle(function->prototype(), isolate); 893 old_value = handle(function->prototype(), isolate);
892 else 894 else
893 old_value = isolate->factory()->NewFunctionPrototype(function); 895 old_value = isolate->factory()->NewFunctionPrototype(function);
894 } 896 }
895 897
896 JSFunction::SetPrototype(function, value); 898 JSFunction::SetPrototype(function, value);
897 DCHECK(function->prototype() == *value); 899 DCHECK(function->prototype() == *value);
898 900
899 if (is_observed && !old_value->SameValue(*value)) { 901 if (is_observed && !old_value->SameValue(*value)) {
900 JSObject::EnqueueChangeRecord( 902 MaybeHandle<Object> result = JSObject::EnqueueChangeRecord(
901 function, "update", isolate->factory()->prototype_string(), old_value); 903 function, "update", isolate->factory()->prototype_string(), old_value);
904 if (result.is_null()) return MaybeHandle<Object>();
902 } 905 }
903 906
904 return function; 907 return function;
905 } 908 }
906 909
907 910
908 Handle<Object> Accessors::FunctionSetPrototype(Handle<JSFunction> function, 911 MaybeHandle<Object> Accessors::FunctionSetPrototype(Handle<JSFunction> function,
909 Handle<Object> prototype) { 912 Handle<Object> prototype) {
910 DCHECK(function->should_have_prototype()); 913 DCHECK(function->should_have_prototype());
911 Isolate* isolate = function->GetIsolate(); 914 Isolate* isolate = function->GetIsolate();
912 return SetFunctionPrototype(isolate, function, prototype); 915 return SetFunctionPrototype(isolate, function, prototype);
913 } 916 }
914 917
915 918
916 void Accessors::FunctionPrototypeGetter( 919 void Accessors::FunctionPrototypeGetter(
917 v8::Local<v8::Name> name, 920 v8::Local<v8::Name> name,
918 const v8::PropertyCallbackInfo<v8::Value>& info) { 921 const v8::PropertyCallbackInfo<v8::Value>& info) {
919 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 922 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
(...skipping 10 matching lines...) Expand all
930 v8::Local<v8::Value> val, 933 v8::Local<v8::Value> val,
931 const v8::PropertyCallbackInfo<void>& info) { 934 const v8::PropertyCallbackInfo<void>& info) {
932 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 935 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
933 HandleScope scope(isolate); 936 HandleScope scope(isolate);
934 Handle<Object> value = Utils::OpenHandle(*val); 937 Handle<Object> value = Utils::OpenHandle(*val);
935 if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) { 938 if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) {
936 return; 939 return;
937 } 940 }
938 Handle<JSFunction> object = 941 Handle<JSFunction> object =
939 Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder())); 942 Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
940 SetFunctionPrototype(isolate, object, value); 943 if (SetFunctionPrototype(isolate, object, value).is_null()) {
944 isolate->OptionalRescheduleException(false);
945 }
941 } 946 }
942 947
943 948
944 Handle<AccessorInfo> Accessors::FunctionPrototypeInfo( 949 Handle<AccessorInfo> Accessors::FunctionPrototypeInfo(
945 Isolate* isolate, PropertyAttributes attributes) { 950 Isolate* isolate, PropertyAttributes attributes) {
946 return MakeAccessor(isolate, 951 return MakeAccessor(isolate,
947 isolate->factory()->prototype_string(), 952 isolate->factory()->prototype_string(),
948 &FunctionPrototypeGetter, 953 &FunctionPrototypeGetter,
949 &FunctionPrototypeSetter, 954 &FunctionPrototypeSetter,
950 attributes); 955 attributes);
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 info->set_data(Smi::FromInt(index)); 1402 info->set_data(Smi::FromInt(index));
1398 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1403 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1399 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1404 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1400 info->set_getter(*getter); 1405 info->set_getter(*getter);
1401 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1406 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1402 return info; 1407 return info;
1403 } 1408 }
1404 1409
1405 1410
1406 } } // namespace v8::internal 1411 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698