OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 NewTypeError(MessageTemplate::kNonObjectPropertyStore, key, object), | 141 NewTypeError(MessageTemplate::kNonObjectPropertyStore, key, object), |
142 Object); | 142 Object); |
143 } | 143 } |
144 | 144 |
145 // Check if the given key is an array index. | 145 // Check if the given key is an array index. |
146 bool success = false; | 146 bool success = false; |
147 LookupIterator it = | 147 LookupIterator it = |
148 LookupIterator::PropertyOrElement(isolate, object, key, &success); | 148 LookupIterator::PropertyOrElement(isolate, object, key, &success); |
149 if (!success) return MaybeHandle<Object>(); | 149 if (!success) return MaybeHandle<Object>(); |
150 | 150 |
151 return Object::SetProperty(&it, value, language_mode, | 151 MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode, |
152 Object::MAY_BE_STORE_FROM_KEYED); | 152 Object::MAY_BE_STORE_FROM_KEYED)); |
| 153 return value; |
153 } | 154 } |
154 | 155 |
155 | 156 |
156 RUNTIME_FUNCTION(Runtime_GetPrototype) { | 157 RUNTIME_FUNCTION(Runtime_GetPrototype) { |
157 HandleScope scope(isolate); | 158 HandleScope scope(isolate); |
158 DCHECK(args.length() == 1); | 159 DCHECK(args.length() == 1); |
159 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); | 160 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); |
160 return *Object::GetPrototype(isolate, obj); | 161 return *Object::GetPrototype(isolate, obj); |
161 } | 162 } |
162 | 163 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 it.GetHolder<Object>().is_identical_to(global_object)) { | 381 it.GetHolder<Object>().is_identical_to(global_object)) { |
381 // Now update cell in the script context. | 382 // Now update cell in the script context. |
382 Handle<PropertyCell> cell = it.GetPropertyCell(); | 383 Handle<PropertyCell> cell = it.GetPropertyCell(); |
383 script_context->set(slot, *cell); | 384 script_context->set(slot, *cell); |
384 } else { | 385 } else { |
385 // This is not a fast case, so keep this access in a slow mode. | 386 // This is not a fast case, so keep this access in a slow mode. |
386 // Store empty_property_cell here to release the outdated property cell. | 387 // Store empty_property_cell here to release the outdated property cell. |
387 script_context->set(slot, isolate->heap()->empty_property_cell()); | 388 script_context->set(slot, isolate->heap()->empty_property_cell()); |
388 } | 389 } |
389 | 390 |
390 Handle<Object> result; | 391 MAYBE_RETURN(Object::SetProperty(&it, value, language_mode, |
391 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 392 Object::CERTAINLY_NOT_STORE_FROM_KEYED), |
392 isolate, result, | 393 isolate->heap()->exception()); |
393 Object::SetProperty(&it, value, language_mode, | 394 return *value; |
394 Object::CERTAINLY_NOT_STORE_FROM_KEYED)); | |
395 return *result; | |
396 } | 395 } |
397 | 396 |
398 } // namespace | 397 } // namespace |
399 | 398 |
400 | 399 |
401 RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext_Sloppy) { | 400 RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext_Sloppy) { |
402 HandleScope scope(isolate); | 401 HandleScope scope(isolate); |
403 DCHECK_EQ(2, args.length()); | 402 DCHECK_EQ(2, args.length()); |
404 CONVERT_SMI_ARG_CHECKED(slot, 0); | 403 CONVERT_SMI_ARG_CHECKED(slot, 0); |
405 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 404 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 | 1573 |
1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1574 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1576 HandleScope scope(isolate); | 1575 HandleScope scope(isolate); |
1577 DCHECK(args.length() == 2); | 1576 DCHECK(args.length() == 2); |
1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1577 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1578 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1580 return JSReceiver::DefineProperties(isolate, o, properties); | 1579 return JSReceiver::DefineProperties(isolate, o, properties); |
1581 } | 1580 } |
1582 } // namespace internal | 1581 } // namespace internal |
1583 } // namespace v8 | 1582 } // namespace v8 |
OLD | NEW |