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/objects.cc

Issue 1758733002: Move the ReferenceError check out of SetPropertyInternal. SetSuperProperty cannot need this case. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 4191 matching lines...) Expand 10 before | Expand all | Expand 10 after
4202 break; 4202 break;
4203 4203
4204 case LookupIterator::TRANSITION: 4204 case LookupIterator::TRANSITION:
4205 done = true; 4205 done = true;
4206 break; 4206 break;
4207 } 4207 }
4208 4208
4209 if (done) break; 4209 if (done) break;
4210 } 4210 }
4211 4211
4212 // If the receiver is the JSGlobalObject, the store was contextual. In case
4213 // the property did not exist yet on the global object itself, we have to
4214 // throw a reference error in strict mode. In sloppy mode, we continue.
4215 if (it->GetReceiver()->IsJSGlobalObject() && is_strict(language_mode)) {
4216 it->isolate()->Throw(*it->isolate()->factory()->NewReferenceError(
4217 MessageTemplate::kNotDefined, it->name()));
4218 return Nothing<bool>();
4219 }
4220
4221 *found = false; 4212 *found = false;
4222 return Nothing<bool>(); 4213 return Nothing<bool>();
4223 } 4214 }
4224 4215
4225 4216
4226 Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value, 4217 Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
4227 LanguageMode language_mode, 4218 LanguageMode language_mode,
4228 StoreFromKeyed store_mode) { 4219 StoreFromKeyed store_mode) {
4229 bool found = false; 4220 bool found = false;
4230 Maybe<bool> result = 4221 Maybe<bool> result =
4231 SetPropertyInternal(it, value, language_mode, store_mode, &found); 4222 SetPropertyInternal(it, value, language_mode, store_mode, &found);
4232 if (found) return result; 4223 if (found) return result;
4224
4225 // If the receiver is the JSGlobalObject, the store was contextual. In case
4226 // the property did not exist yet on the global object itself, we have to
4227 // throw a reference error in strict mode. In sloppy mode, we continue.
4228 if (is_strict(language_mode) && it->GetReceiver()->IsJSGlobalObject()) {
4229 it->isolate()->Throw(*it->isolate()->factory()->NewReferenceError(
4230 MessageTemplate::kNotDefined, it->name()));
4231 return Nothing<bool>();
4232 }
4233
4233 ShouldThrow should_throw = 4234 ShouldThrow should_throw =
4234 is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; 4235 is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR;
4235 return AddDataProperty(it, value, NONE, should_throw, store_mode); 4236 return AddDataProperty(it, value, NONE, should_throw, store_mode);
4236 } 4237 }
4237 4238
4238 4239
4239 Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value, 4240 Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
4240 LanguageMode language_mode, 4241 LanguageMode language_mode,
4241 StoreFromKeyed store_mode) { 4242 StoreFromKeyed store_mode) {
4242 Isolate* isolate = it->isolate(); 4243 Isolate* isolate = it->isolate();
(...skipping 15526 matching lines...) Expand 10 before | Expand all | Expand 10 after
19769 if (cell->value() != *new_value) { 19770 if (cell->value() != *new_value) {
19770 cell->set_value(*new_value); 19771 cell->set_value(*new_value);
19771 Isolate* isolate = cell->GetIsolate(); 19772 Isolate* isolate = cell->GetIsolate();
19772 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19773 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19773 isolate, DependentCode::kPropertyCellChangedGroup); 19774 isolate, DependentCode::kPropertyCellChangedGroup);
19774 } 19775 }
19775 } 19776 }
19776 19777
19777 } // namespace internal 19778 } // namespace internal
19778 } // namespace v8 19779 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698