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

Side by Side Diff: src/ic.cc

Issue 11347037: Object.observe: generate change records for named properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 1370
1371 // Check if the given name is an array index. 1371 // Check if the given name is an array index.
1372 uint32_t index; 1372 uint32_t index;
1373 if (name->AsArrayIndex(&index)) { 1373 if (name->AsArrayIndex(&index)) {
1374 Handle<Object> result = 1374 Handle<Object> result =
1375 JSObject::SetElement(receiver, index, value, NONE, strict_mode); 1375 JSObject::SetElement(receiver, index, value, NONE, strict_mode);
1376 RETURN_IF_EMPTY_HANDLE(isolate(), result); 1376 RETURN_IF_EMPTY_HANDLE(isolate(), result);
1377 return *value; 1377 return *value;
1378 } 1378 }
1379 1379
1380 // Observed objects are always modified through the runtime.
1381 if (FLAG_harmony_observation && receiver->map()->is_observed()) {
1382 return receiver->SetProperty(*name, *value, NONE, strict_mode);
1383 }
1384
1380 // Use specialized code for setting the length of arrays with fast 1385 // Use specialized code for setting the length of arrays with fast
1381 // properties. Slow properties might indicate redefinition of the 1386 // properties. Slow properties might indicate redefinition of the
1382 // length property. 1387 // length property.
1383 if (receiver->IsJSArray() && 1388 if (receiver->IsJSArray() &&
1384 name->Equals(isolate()->heap()->length_symbol()) && 1389 name->Equals(isolate()->heap()->length_symbol()) &&
1385 Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() && 1390 Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() &&
1386 receiver->HasFastProperties()) { 1391 receiver->HasFastProperties()) {
1387 #ifdef DEBUG 1392 #ifdef DEBUG
1388 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); 1393 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n");
1389 #endif 1394 #endif
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 // Check if the given name is an array index. 1900 // Check if the given name is an array index.
1896 uint32_t index; 1901 uint32_t index;
1897 if (name->AsArrayIndex(&index)) { 1902 if (name->AsArrayIndex(&index)) {
1898 Handle<Object> result = 1903 Handle<Object> result =
1899 JSObject::SetElement(receiver, index, value, NONE, strict_mode); 1904 JSObject::SetElement(receiver, index, value, NONE, strict_mode);
1900 RETURN_IF_EMPTY_HANDLE(isolate(), result); 1905 RETURN_IF_EMPTY_HANDLE(isolate(), result);
1901 return *value; 1906 return *value;
1902 } 1907 }
1903 1908
1904 // Update inline cache and stub cache. 1909 // Update inline cache and stub cache.
1905 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { 1910 if (FLAG_use_ic && !receiver->IsJSGlobalProxy() &&
1911 !(FLAG_harmony_observation && receiver->map()->is_observed())) {
1906 LookupResult lookup(isolate()); 1912 LookupResult lookup(isolate());
1907 if (LookupForWrite(receiver, name, &lookup)) { 1913 if (LookupForWrite(receiver, name, &lookup)) {
1908 UpdateCaches(&lookup, state, strict_mode, receiver, name, value); 1914 UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1909 } 1915 }
1910 } 1916 }
1911 1917
1912 // Set the property. 1918 // Set the property.
1913 return receiver->SetProperty(*name, *value, NONE, strict_mode); 1919 return receiver->SetProperty(*name, *value, NONE, strict_mode);
1914 } 1920 }
1915 1921
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 #undef ADDR 2700 #undef ADDR
2695 }; 2701 };
2696 2702
2697 2703
2698 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2704 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2699 return IC_utilities[id]; 2705 return IC_utilities[id];
2700 } 2706 }
2701 2707
2702 2708
2703 } } // namespace v8::internal 2709 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/object-observe.js » ('j') | src/object-observe.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698