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

Side by Side Diff: src/ic.cc

Issue 10659011: Correctly throw reference error in strict mode with ICs disabled. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); 1378 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n");
1379 #endif 1379 #endif
1380 Handle<Code> stub = (strict_mode == kStrictMode) 1380 Handle<Code> stub = (strict_mode == kStrictMode)
1381 ? isolate()->builtins()->StoreIC_ArrayLength_Strict() 1381 ? isolate()->builtins()->StoreIC_ArrayLength_Strict()
1382 : isolate()->builtins()->StoreIC_ArrayLength(); 1382 : isolate()->builtins()->StoreIC_ArrayLength();
1383 set_target(*stub); 1383 set_target(*stub);
1384 return receiver->SetProperty(*name, *value, NONE, strict_mode); 1384 return receiver->SetProperty(*name, *value, NONE, strict_mode);
1385 } 1385 }
1386 1386
1387 // Lookup the property locally in the receiver. 1387 // Lookup the property locally in the receiver.
1388 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { 1388 if (!receiver->IsJSGlobalProxy()) {
1389 LookupResult lookup(isolate()); 1389 LookupResult lookup(isolate());
1390 1390
1391 if (LookupForWrite(receiver, name, &lookup)) { 1391 if (LookupForWrite(receiver, name, &lookup)) {
1392 // Generate a stub for this store. 1392 if (FLAG_use_ic) { // Generate a stub for this store.
1393 UpdateCaches(&lookup, state, strict_mode, receiver, name, value); 1393 UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1394 }
1394 } else { 1395 } else {
1395 // Strict mode doesn't allow setting non-existent global property 1396 // Strict mode doesn't allow setting non-existent global property
1396 // or an assignment to a read only property. 1397 // or an assignment to a read only property.
1397 if (strict_mode == kStrictMode) { 1398 if (strict_mode == kStrictMode) {
1398 if (lookup.IsProperty() && lookup.IsReadOnly()) { 1399 if (lookup.IsProperty() && lookup.IsReadOnly()) {
1399 return TypeError("strict_read_only_property", object, name); 1400 return TypeError("strict_read_only_property", object, name);
1400 } else if (IsContextual(object)) { 1401 } else if (IsContextual(object)) {
1401 return ReferenceError("not_defined", name); 1402 return ReferenceError("not_defined", name);
1402 } 1403 }
1403 } 1404 }
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 #undef ADDR 2670 #undef ADDR
2670 }; 2671 };
2671 2672
2672 2673
2673 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2674 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2674 return IC_utilities[id]; 2675 return IC_utilities[id];
2675 } 2676 }
2676 2677
2677 2678
2678 } } // namespace v8::internal 2679 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2119.js » ('j') | test/mjsunit/regress/regress-2119.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698