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

Side by Side Diff: src/runtime.cc

Issue 439243005: Ensure prototypes always stay fast by turning them fast again after an operation that turned them s… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/objects.cc ('k') | test/mjsunit/dictionary-properties.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 5002
5003 LookupResult lookup(isolate); 5003 LookupResult lookup(isolate);
5004 js_object->LookupOwnRealNamedProperty(name, &lookup); 5004 js_object->LookupOwnRealNamedProperty(name, &lookup);
5005 5005
5006 // Take special care when attributes are different and there is already 5006 // Take special care when attributes are different and there is already
5007 // a property. For simplicity we normalize the property which enables us 5007 // a property. For simplicity we normalize the property which enables us
5008 // to not worry about changing the instance_descriptor and creating a new 5008 // to not worry about changing the instance_descriptor and creating a new
5009 // map. 5009 // map.
5010 if (lookup.IsFound() && 5010 if (lookup.IsFound() &&
5011 (attr != lookup.GetAttributes() || lookup.IsPropertyCallbacks())) { 5011 (attr != lookup.GetAttributes() || lookup.IsPropertyCallbacks())) {
5012 // New attributes - normalize to avoid writing to instance descriptor
5013 if (js_object->IsJSGlobalProxy()) {
5014 // Since the result is a property, the prototype will exist so
5015 // we don't have to check for null.
5016 PrototypeIterator iter(isolate, js_object);
5017 js_object = Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter));
5018 }
5019
5020 if (attr != lookup.GetAttributes() ||
5021 (lookup.IsPropertyCallbacks() &&
5022 !lookup.GetCallbackObject()->IsAccessorInfo())) {
5023 JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
5024 }
5025
5026 // Use IgnoreAttributes version since a readonly property may be 5012 // Use IgnoreAttributes version since a readonly property may be
5027 // overridden and SetProperty does not allow this. 5013 // overridden and SetProperty does not allow this.
5028 Handle<Object> result; 5014 Handle<Object> result;
5029 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 5015 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
5030 isolate, result, 5016 isolate, result,
5031 JSObject::SetOwnPropertyIgnoreAttributes( 5017 JSObject::SetOwnPropertyIgnoreAttributes(
5032 js_object, name, obj_value, attr, 5018 js_object, name, obj_value, attr,
5033 JSReceiver::PERFORM_EXTENSIBILITY_CHECK, 5019 JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
5034 JSReceiver::MAY_BE_STORE_FROM_KEYED, 5020 JSReceiver::MAY_BE_STORE_FROM_KEYED,
5035 JSObject::DONT_FORCE_FIELD)); 5021 JSObject::DONT_FORCE_FIELD));
(...skipping 10548 matching lines...) Expand 10 before | Expand all | Expand 10 after
15584 } 15570 }
15585 return NULL; 15571 return NULL;
15586 } 15572 }
15587 15573
15588 15574
15589 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15575 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15590 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15576 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15591 } 15577 }
15592 15578
15593 } } // namespace v8::internal 15579 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/dictionary-properties.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698