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

Side by Side Diff: src/objects.cc

Issue 1181013011: Support CreateDataProperty on JSObject in the runtime (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« src/api.cc ('K') | « src/objects.h ('k') | 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 // 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
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 4278 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( 4289 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes(
4290 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, 4290 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
4291 PropertyAttributes attributes, ExecutableAccessorInfoHandling handling) { 4291 PropertyAttributes attributes, ExecutableAccessorInfoHandling handling) {
4292 Isolate* isolate = object->GetIsolate(); 4292 Isolate* isolate = object->GetIsolate();
4293 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name, 4293 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name,
4294 LookupIterator::OWN); 4294 LookupIterator::OWN);
4295 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling); 4295 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
4296 } 4296 }
4297 4297
4298 4298
4299 Maybe<bool> JSObject::CreateDataProperty(LookupIterator* it,
4300 Handle<Object> value) {
4301 DCHECK(it->GetReceiver()->IsJSObject());
4302 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(it);
4303 if (maybe.IsNothing()) return Nothing<bool>();
4304
4305 if (it->IsFound()) {
4306 if (!it->IsConfigurable()) return Just(false);
4307 } else {
4308 if (!JSObject::cast(*it->GetReceiver())->IsExtensible()) return Just(false);
4309 }
4310
4311 RETURN_ON_EXCEPTION_VALUE(
4312 it->isolate(),
4313 DefineOwnPropertyIgnoreAttributes(it, value, NONE, DONT_FORCE_FIELD),
4314 Nothing<bool>());
4315
4316 return Just(true);
4317 }
4318
4319
4299 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( 4320 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
4300 LookupIterator* it) { 4321 LookupIterator* it) {
4301 Isolate* isolate = it->isolate(); 4322 Isolate* isolate = it->isolate();
4302 // Make sure that the top context does not change when doing 4323 // Make sure that the top context does not change when doing
4303 // callbacks or interceptor calls. 4324 // callbacks or interceptor calls.
4304 AssertNoContextChange ncc(isolate); 4325 AssertNoContextChange ncc(isolate);
4305 HandleScope scope(isolate); 4326 HandleScope scope(isolate);
4306 4327
4307 Handle<JSObject> holder = it->GetHolder<JSObject>(); 4328 Handle<JSObject> holder = it->GetHolder<JSObject>();
4308 Handle<InterceptorInfo> interceptor(it->GetInterceptor()); 4329 Handle<InterceptorInfo> interceptor(it->GetInterceptor());
(...skipping 12316 matching lines...) Expand 10 before | Expand all | Expand 10 after
16625 Handle<Object> new_value) { 16646 Handle<Object> new_value) {
16626 if (cell->value() != *new_value) { 16647 if (cell->value() != *new_value) {
16627 cell->set_value(*new_value); 16648 cell->set_value(*new_value);
16628 Isolate* isolate = cell->GetIsolate(); 16649 Isolate* isolate = cell->GetIsolate();
16629 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16650 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16630 isolate, DependentCode::kPropertyCellChangedGroup); 16651 isolate, DependentCode::kPropertyCellChangedGroup);
16631 } 16652 }
16632 } 16653 }
16633 } // namespace internal 16654 } // namespace internal
16634 } // namespace v8 16655 } // namespace v8
OLDNEW
« src/api.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698