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

Side by Side Diff: src/runtime.cc

Issue 6451003: Correct propagation of exceptions from setters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-ia32
Patch Set: Addressed review comments Created 9 years, 10 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 | test/mjsunit/regress/regress-1105.js » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 // that claims the property is absent. 1082 // that claims the property is absent.
1083 1083
1084 // Check for conflicting re-declarations. We cannot have 1084 // Check for conflicting re-declarations. We cannot have
1085 // conflicting types in case of intercepted properties because 1085 // conflicting types in case of intercepted properties because
1086 // they are absent. 1086 // they are absent.
1087 if (lookup.type() != INTERCEPTOR && 1087 if (lookup.type() != INTERCEPTOR &&
1088 (lookup.IsReadOnly() || is_const_property)) { 1088 (lookup.IsReadOnly() || is_const_property)) {
1089 const char* type = (lookup.IsReadOnly()) ? "const" : "var"; 1089 const char* type = (lookup.IsReadOnly()) ? "const" : "var";
1090 return ThrowRedeclarationError(type, name); 1090 return ThrowRedeclarationError(type, name);
1091 } 1091 }
1092 SetProperty(global, name, value, attributes); 1092 Handle<Object> result = SetProperty(global, name, value, attributes);
1093 if (result.is_null()) {
1094 ASSERT(Top::has_pending_exception());
1095 return Failure::Exception();
1096 }
1093 } else { 1097 } else {
1094 // If a property with this name does not already exist on the 1098 // If a property with this name does not already exist on the
1095 // global object add the property locally. We take special 1099 // global object add the property locally. We take special
1096 // precautions to always add it as a local property even in case 1100 // precautions to always add it as a local property even in case
1097 // of callbacks in the prototype chain (this rules out using 1101 // of callbacks in the prototype chain (this rules out using
1098 // SetProperty). Also, we must use the handle-based version to 1102 // SetProperty). Also, we must use the handle-based version to
1099 // avoid GC issues. 1103 // avoid GC issues.
1100 SetLocalPropertyIgnoreAttributes(global, name, value, attributes); 1104 Handle<Object> result =
1105 SetLocalPropertyIgnoreAttributes(global, name, value, attributes);
1106 if (result.is_null()) {
1107 ASSERT(Top::has_pending_exception());
1108 return Failure::Exception();
1109 }
1101 } 1110 }
1102 } 1111 }
1103 1112
1113 ASSERT(!Top::has_pending_exception());
1104 return Heap::undefined_value(); 1114 return Heap::undefined_value();
1105 } 1115 }
1106 1116
1107 1117
1108 static MaybeObject* Runtime_DeclareContextSlot(Arguments args) { 1118 static MaybeObject* Runtime_DeclareContextSlot(Arguments args) {
1109 HandleScope scope; 1119 HandleScope scope;
1110 ASSERT(args.length() == 4); 1120 ASSERT(args.length() == 4);
1111 1121
1112 CONVERT_ARG_CHECKED(Context, context, 0); 1122 CONVERT_ARG_CHECKED(Context, context, 0);
1113 Handle<String> name(String::cast(args[1])); 1123 Handle<String> name(String::cast(args[1]));
(...skipping 9960 matching lines...) Expand 10 before | Expand all | Expand 10 after
11074 } else { 11084 } else {
11075 // Handle last resort GC and make sure to allow future allocations 11085 // Handle last resort GC and make sure to allow future allocations
11076 // to grow the heap without causing GCs (if possible). 11086 // to grow the heap without causing GCs (if possible).
11077 Counters::gc_last_resort_from_js.Increment(); 11087 Counters::gc_last_resort_from_js.Increment();
11078 Heap::CollectAllGarbage(false); 11088 Heap::CollectAllGarbage(false);
11079 } 11089 }
11080 } 11090 }
11081 11091
11082 11092
11083 } } // namespace v8::internal 11093 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1105.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698