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

Side by Side Diff: src/objects.cc

Issue 14493012: Fix evaluation order problems in Object.observe hooks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 3271
3272 Handle<Object> hresult; 3272 Handle<Object> hresult;
3273 if (!result->ToHandle(&hresult, isolate)) return result; 3273 if (!result->ToHandle(&hresult, isolate)) return result;
3274 3274
3275 if (FLAG_harmony_observation && map()->is_observed()) { 3275 if (FLAG_harmony_observation && map()->is_observed()) {
3276 if (lookup->IsTransition()) { 3276 if (lookup->IsTransition()) {
3277 EnqueueChangeRecord(self, "new", name, old_value); 3277 EnqueueChangeRecord(self, "new", name, old_value);
3278 } else { 3278 } else {
3279 LookupResult new_lookup(isolate); 3279 LookupResult new_lookup(isolate);
3280 self->LocalLookup(*name, &new_lookup, true); 3280 self->LocalLookup(*name, &new_lookup, true);
3281 if (new_lookup.IsDataProperty() && 3281 if (new_lookup.IsDataProperty()) {
3282 !Object::GetProperty(self, name)->SameValue(*old_value)) { 3282 Handle<Object> new_value = Object::GetProperty(self, name);
3283 EnqueueChangeRecord(self, "updated", name, old_value); 3283 if (!new_value->SameValue(*old_value)) {
3284 EnqueueChangeRecord(self, "updated", name, old_value);
3285 }
3284 } 3286 }
3285 } 3287 }
3286 } 3288 }
3287 3289
3288 return *hresult; 3290 return *hresult;
3289 } 3291 }
3290 3292
3291 3293
3292 // Set a real local property, even if it is READ_ONLY. If the property is not 3294 // Set a real local property, even if it is READ_ONLY. If the property is not
3293 // present, add it with attributes NONE. This code is an exact clone of 3295 // present, add it with attributes NONE. This code is an exact clone of
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 if (!result->ToHandle(&hresult, isolate)) return result; 3425 if (!result->ToHandle(&hresult, isolate)) return result;
3424 3426
3425 if (is_observed) { 3427 if (is_observed) {
3426 if (lookup.IsTransition()) { 3428 if (lookup.IsTransition()) {
3427 EnqueueChangeRecord(self, "new", name, old_value); 3429 EnqueueChangeRecord(self, "new", name, old_value);
3428 } else if (old_value->IsTheHole()) { 3430 } else if (old_value->IsTheHole()) {
3429 EnqueueChangeRecord(self, "reconfigured", name, old_value); 3431 EnqueueChangeRecord(self, "reconfigured", name, old_value);
3430 } else { 3432 } else {
3431 LookupResult new_lookup(isolate); 3433 LookupResult new_lookup(isolate);
3432 self->LocalLookup(*name, &new_lookup, true); 3434 self->LocalLookup(*name, &new_lookup, true);
3433 bool value_changed = new_lookup.IsDataProperty() && 3435 bool value_changed = false;
3434 !old_value->SameValue(*Object::GetProperty(self, name)); 3436 if (new_lookup.IsDataProperty()) {
3437 Handle<Object> new_value = Object::GetProperty(self, name);
3438 value_changed = !old_value->SameValue(*new_value);
3439 }
3435 if (new_lookup.GetAttributes() != old_attributes) { 3440 if (new_lookup.GetAttributes() != old_attributes) {
3436 if (!value_changed) old_value = isolate->factory()->the_hole_value(); 3441 if (!value_changed) old_value = isolate->factory()->the_hole_value();
3437 EnqueueChangeRecord(self, "reconfigured", name, old_value); 3442 EnqueueChangeRecord(self, "reconfigured", name, old_value);
3438 } else if (value_changed) { 3443 } else if (value_changed) {
3439 EnqueueChangeRecord(self, "updated", name, old_value); 3444 EnqueueChangeRecord(self, "updated", name, old_value);
3440 } 3445 }
3441 } 3446 }
3442 } 3447 }
3443 3448
3444 return *hresult; 3449 return *hresult;
(...skipping 7522 matching lines...) Expand 10 before | Expand all | Expand 10 after
10967 if (old_attributes == ABSENT) { 10972 if (old_attributes == ABSENT) {
10968 EnqueueChangeRecord(self, "new", name, old_value); 10973 EnqueueChangeRecord(self, "new", name, old_value);
10969 if (self->IsJSArray() && 10974 if (self->IsJSArray() &&
10970 !old_length->SameValue(Handle<JSArray>::cast(self)->length())) { 10975 !old_length->SameValue(Handle<JSArray>::cast(self)->length())) {
10971 EnqueueChangeRecord( 10976 EnqueueChangeRecord(
10972 self, "updated", isolate->factory()->length_string(), old_length); 10977 self, "updated", isolate->factory()->length_string(), old_length);
10973 } 10978 }
10974 } else if (old_value->IsTheHole()) { 10979 } else if (old_value->IsTheHole()) {
10975 EnqueueChangeRecord(self, "reconfigured", name, old_value); 10980 EnqueueChangeRecord(self, "reconfigured", name, old_value);
10976 } else { 10981 } else {
10977 bool value_changed = 10982 Handle<Object> new_value = Object::GetElement(self, index);
10978 !old_value->SameValue(*Object::GetElement(self, index)); 10983 bool value_changed = !old_value->SameValue(*new_value);
10979 if (old_attributes != new_attributes) { 10984 if (old_attributes != new_attributes) {
10980 if (!value_changed) old_value = isolate->factory()->the_hole_value(); 10985 if (!value_changed) old_value = isolate->factory()->the_hole_value();
10981 EnqueueChangeRecord(self, "reconfigured", name, old_value); 10986 EnqueueChangeRecord(self, "reconfigured", name, old_value);
10982 } else if (value_changed) { 10987 } else if (value_changed) {
10983 EnqueueChangeRecord(self, "updated", name, old_value); 10988 EnqueueChangeRecord(self, "updated", name, old_value);
10984 } 10989 }
10985 } 10990 }
10986 10991
10987 return *hresult; 10992 return *hresult;
10988 } 10993 }
(...skipping 3540 matching lines...) Expand 10 before | Expand all | Expand 10 after
14529 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14534 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14530 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14535 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14531 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14536 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14532 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14537 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14533 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14538 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14534 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14539 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14535 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14540 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14536 } 14541 }
14537 14542
14538 } } // namespace v8::internal 14543 } } // namespace v8::internal
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