| OLD | NEW |
| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // the handle based operations. In that case, we need to | 303 // the handle based operations. In that case, we need to |
| 304 // convert back to an exception. | 304 // convert back to an exception. |
| 305 RETURN_ON_EXCEPTION(isolate, maybe_result, Object); | 305 RETURN_ON_EXCEPTION(isolate, maybe_result, Object); |
| 306 } | 306 } |
| 307 | 307 |
| 308 // Transform to fast properties if necessary. For object literals with | 308 // Transform to fast properties if necessary. For object literals with |
| 309 // containing function literals we defer this operation until after all | 309 // containing function literals we defer this operation until after all |
| 310 // computed properties have been assigned so that we can generate | 310 // computed properties have been assigned so that we can generate |
| 311 // constant function properties. | 311 // constant function properties. |
| 312 if (should_transform && !has_function_literal) { | 312 if (should_transform && !has_function_literal) { |
| 313 JSObject::TransformToFastProperties( | 313 JSObject::MigrateSlowToFast( |
| 314 boilerplate, boilerplate->map()->unused_property_fields()); | 314 boilerplate, boilerplate->map()->unused_property_fields()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 return boilerplate; | 317 return boilerplate; |
| 318 } | 318 } |
| 319 | 319 |
| 320 | 320 |
| 321 MUST_USE_RESULT static MaybeHandle<Object> TransitionElements( | 321 MUST_USE_RESULT static MaybeHandle<Object> TransitionElements( |
| 322 Handle<Object> object, | 322 Handle<Object> object, |
| 323 ElementsKind to_kind, | 323 ElementsKind to_kind, |
| (...skipping 4724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5048 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | 5048 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); |
| 5049 RUNTIME_ASSERT(IsValidAccessor(setter)); | 5049 RUNTIME_ASSERT(IsValidAccessor(setter)); |
| 5050 CONVERT_SMI_ARG_CHECKED(unchecked, 4); | 5050 CONVERT_SMI_ARG_CHECKED(unchecked, 4); |
| 5051 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5051 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 5052 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 5052 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 5053 | 5053 |
| 5054 bool fast = obj->HasFastProperties(); | 5054 bool fast = obj->HasFastProperties(); |
| 5055 // DefineAccessor checks access rights. | 5055 // DefineAccessor checks access rights. |
| 5056 JSObject::DefineAccessor(obj, name, getter, setter, attr); | 5056 JSObject::DefineAccessor(obj, name, getter, setter, attr); |
| 5057 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 5057 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5058 if (fast) JSObject::TransformToFastProperties(obj, 0); | 5058 if (fast) JSObject::MigrateSlowToFast(obj, 0); |
| 5059 return isolate->heap()->undefined_value(); | 5059 return isolate->heap()->undefined_value(); |
| 5060 } | 5060 } |
| 5061 | 5061 |
| 5062 | 5062 |
| 5063 // Implements part of 8.12.9 DefineOwnProperty. | 5063 // Implements part of 8.12.9 DefineOwnProperty. |
| 5064 // There are 3 cases that lead here: | 5064 // There are 3 cases that lead here: |
| 5065 // Step 4a - define a new data property. | 5065 // Step 4a - define a new data property. |
| 5066 // Steps 9b & 12 - replace an existing accessor property with a data property. | 5066 // Steps 9b & 12 - replace an existing accessor property with a data property. |
| 5067 // Step 12 - update an existing data property with a data or generic | 5067 // Step 12 - update an existing data property with a data or generic |
| 5068 // descriptor. | 5068 // descriptor. |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6029 Object::GetProperty(isolate->initial_object_prototype(), key)); | 6029 Object::GetProperty(isolate->initial_object_prototype(), key)); |
| 6030 return *result; | 6030 return *result; |
| 6031 } | 6031 } |
| 6032 | 6032 |
| 6033 | 6033 |
| 6034 RUNTIME_FUNCTION(Runtime_ToFastProperties) { | 6034 RUNTIME_FUNCTION(Runtime_ToFastProperties) { |
| 6035 HandleScope scope(isolate); | 6035 HandleScope scope(isolate); |
| 6036 ASSERT(args.length() == 1); | 6036 ASSERT(args.length() == 1); |
| 6037 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 6037 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 6038 if (object->IsJSObject() && !object->IsGlobalObject()) { | 6038 if (object->IsJSObject() && !object->IsGlobalObject()) { |
| 6039 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0); | 6039 JSObject::MigrateSlowToFast(Handle<JSObject>::cast(object), 0); |
| 6040 } | 6040 } |
| 6041 return *object; | 6041 return *object; |
| 6042 } | 6042 } |
| 6043 | 6043 |
| 6044 | 6044 |
| 6045 RUNTIME_FUNCTION(Runtime_ToBool) { | 6045 RUNTIME_FUNCTION(Runtime_ToBool) { |
| 6046 SealHandleScope shs(isolate); | 6046 SealHandleScope shs(isolate); |
| 6047 ASSERT(args.length() == 1); | 6047 ASSERT(args.length() == 1); |
| 6048 CONVERT_ARG_CHECKED(Object, object, 0); | 6048 CONVERT_ARG_CHECKED(Object, object, 0); |
| 6049 | 6049 |
| (...skipping 9071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15121 } | 15121 } |
| 15122 return NULL; | 15122 return NULL; |
| 15123 } | 15123 } |
| 15124 | 15124 |
| 15125 | 15125 |
| 15126 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15126 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15127 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15127 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15128 } | 15128 } |
| 15129 | 15129 |
| 15130 } } // namespace v8::internal | 15130 } } // namespace v8::internal |
| OLD | NEW |