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

Side by Side Diff: src/ic.cc

Issue 6613005: Implementation of strict mode in SetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: SetElement in strict mode. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 } 1398 }
1399 1399
1400 // Ignore stores where the receiver is not a JSObject. 1400 // Ignore stores where the receiver is not a JSObject.
1401 if (!object->IsJSObject()) return *value; 1401 if (!object->IsJSObject()) return *value;
1402 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1402 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1403 1403
1404 // Check if the given name is an array index. 1404 // Check if the given name is an array index.
1405 uint32_t index; 1405 uint32_t index;
1406 if (name->AsArrayIndex(&index)) { 1406 if (name->AsArrayIndex(&index)) {
1407 HandleScope scope; 1407 HandleScope scope;
1408 Handle<Object> result = SetElement(receiver, index, value); 1408 Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1409 if (result.is_null()) return Failure::Exception(); 1409 if (result.is_null()) return Failure::Exception();
1410 return *value; 1410 return *value;
1411 } 1411 }
1412 1412
1413 // Use specialized code for setting the length of arrays. 1413 // Use specialized code for setting the length of arrays.
1414 if (receiver->IsJSArray() 1414 if (receiver->IsJSArray()
1415 && name->Equals(Heap::length_symbol()) 1415 && name->Equals(Heap::length_symbol())
1416 && receiver->AllowsSetElementsLength()) { 1416 && receiver->AllowsSetElementsLength()) {
1417 #ifdef DEBUG 1417 #ifdef DEBUG
1418 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); 1418 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n");
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 } 1624 }
1625 1625
1626 // Ignore stores where the receiver is not a JSObject. 1626 // Ignore stores where the receiver is not a JSObject.
1627 if (!object->IsJSObject()) return *value; 1627 if (!object->IsJSObject()) return *value;
1628 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1628 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1629 1629
1630 // Check if the given name is an array index. 1630 // Check if the given name is an array index.
1631 uint32_t index; 1631 uint32_t index;
1632 if (name->AsArrayIndex(&index)) { 1632 if (name->AsArrayIndex(&index)) {
1633 HandleScope scope; 1633 HandleScope scope;
1634 Handle<Object> result = SetElement(receiver, index, value); 1634 Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1635 if (result.is_null()) return Failure::Exception(); 1635 if (result.is_null()) return Failure::Exception();
1636 return *value; 1636 return *value;
1637 } 1637 }
1638 1638
1639 // Lookup the property locally in the receiver. 1639 // Lookup the property locally in the receiver.
1640 LookupResult lookup; 1640 LookupResult lookup;
1641 receiver->LocalLookup(*name, &lookup); 1641 receiver->LocalLookup(*name, &lookup);
1642 1642
1643 // Update inline cache and stub cache. 1643 // Update inline cache and stub cache.
1644 if (FLAG_use_ic) { 1644 if (FLAG_use_ic) {
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 #undef ADDR 2324 #undef ADDR
2325 }; 2325 };
2326 2326
2327 2327
2328 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2328 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2329 return IC_utilities[id]; 2329 return IC_utilities[id];
2330 } 2330 }
2331 2331
2332 2332
2333 } } // namespace v8::internal 2333 } } // namespace v8::internal
OLDNEW
« src/handles.cc ('K') | « src/handles.cc ('k') | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698