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

Side by Side Diff: src/ic.cc

Issue 195123005: Revert "Enable Object.observe by default" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/flag-definitions.h ('k') | src/object-observe.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 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 // Check if the given name is an array index. 1196 // Check if the given name is an array index.
1197 uint32_t index; 1197 uint32_t index;
1198 if (name->AsArrayIndex(&index)) { 1198 if (name->AsArrayIndex(&index)) {
1199 Handle<Object> result = 1199 Handle<Object> result =
1200 JSObject::SetElement(receiver, index, value, NONE, strict_mode()); 1200 JSObject::SetElement(receiver, index, value, NONE, strict_mode());
1201 RETURN_IF_EMPTY_HANDLE(isolate(), result); 1201 RETURN_IF_EMPTY_HANDLE(isolate(), result);
1202 return *value; 1202 return *value;
1203 } 1203 }
1204 1204
1205 // Observed objects are always modified through the runtime. 1205 // Observed objects are always modified through the runtime.
1206 if (receiver->map()->is_observed()) { 1206 if (FLAG_harmony_observation && receiver->map()->is_observed()) {
1207 Handle<Object> result = JSReceiver::SetProperty( 1207 Handle<Object> result = JSReceiver::SetProperty(
1208 receiver, name, value, NONE, strict_mode(), store_mode); 1208 receiver, name, value, NONE, strict_mode(), store_mode);
1209 RETURN_IF_EMPTY_HANDLE(isolate(), result); 1209 RETURN_IF_EMPTY_HANDLE(isolate(), result);
1210 return *result; 1210 return *result;
1211 } 1211 }
1212 1212
1213 // Use specialized code for setting the length of arrays with fast 1213 // Use specialized code for setting the length of arrays with fast
1214 // properties. Slow properties might indicate redefinition of the length 1214 // properties. Slow properties might indicate redefinition of the length
1215 // property. Note that when redefined using Object.freeze, it's possible 1215 // property. Note that when redefined using Object.freeze, it's possible
1216 // to have fast properties but a read-only length. 1216 // to have fast properties but a read-only length.
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 Handle<Code> stub = generic_stub(); 1663 Handle<Code> stub = generic_stub();
1664 1664
1665 if (key->IsInternalizedString()) { 1665 if (key->IsInternalizedString()) {
1666 maybe_object = StoreIC::Store(object, 1666 maybe_object = StoreIC::Store(object,
1667 Handle<String>::cast(key), 1667 Handle<String>::cast(key),
1668 value, 1668 value,
1669 JSReceiver::MAY_BE_STORE_FROM_KEYED); 1669 JSReceiver::MAY_BE_STORE_FROM_KEYED);
1670 if (maybe_object->IsFailure()) return maybe_object; 1670 if (maybe_object->IsFailure()) return maybe_object;
1671 } else { 1671 } else {
1672 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded() && 1672 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded() &&
1673 !(object->IsJSObject() && 1673 !(FLAG_harmony_observation && object->IsJSObject() &&
1674 JSObject::cast(*object)->map()->is_observed()); 1674 JSObject::cast(*object)->map()->is_observed());
1675 if (use_ic && !object->IsSmi()) { 1675 if (use_ic && !object->IsSmi()) {
1676 // Don't use ICs for maps of the objects in Array's prototype chain. We 1676 // Don't use ICs for maps of the objects in Array's prototype chain. We
1677 // expect to be able to trap element sets to objects with those maps in 1677 // expect to be able to trap element sets to objects with those maps in
1678 // the runtime to enable optimization of element hole access. 1678 // the runtime to enable optimization of element hole access.
1679 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); 1679 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object);
1680 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false; 1680 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false;
1681 } 1681 }
1682 1682
1683 if (use_ic) { 1683 if (use_ic) {
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 #undef ADDR 2817 #undef ADDR
2818 }; 2818 };
2819 2819
2820 2820
2821 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2821 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2822 return IC_utilities[id]; 2822 return IC_utilities[id];
2823 } 2823 }
2824 2824
2825 2825
2826 } } // namespace v8::internal 2826 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698