| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 isolate, value, | 266 isolate, value, |
| 267 CreateLiteralBoilerplate(isolate, literals, array), | 267 CreateLiteralBoilerplate(isolate, literals, array), |
| 268 Object); | 268 Object); |
| 269 } | 269 } |
| 270 MaybeHandle<Object> maybe_result; | 270 MaybeHandle<Object> maybe_result; |
| 271 uint32_t element_index = 0; | 271 uint32_t element_index = 0; |
| 272 StoreMode mode = value->IsJSObject() ? FORCE_FIELD : ALLOW_AS_CONSTANT; | 272 StoreMode mode = value->IsJSObject() ? FORCE_FIELD : ALLOW_AS_CONSTANT; |
| 273 if (key->IsInternalizedString()) { | 273 if (key->IsInternalizedString()) { |
| 274 if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) { | 274 if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) { |
| 275 // Array index as string (uint32). | 275 // Array index as string (uint32). |
| 276 maybe_result = JSObject::SetOwnElement( | 276 if (value->IsUninitialized()) { |
| 277 boilerplate, element_index, value, SLOPPY); | 277 maybe_result = value; |
| 278 } else { |
| 279 maybe_result = JSObject::SetOwnElement( |
| 280 boilerplate, element_index, value, SLOPPY); |
| 281 } |
| 278 } else { | 282 } else { |
| 279 Handle<String> name(String::cast(*key)); | 283 Handle<String> name(String::cast(*key)); |
| 280 ASSERT(!name->AsArrayIndex(&element_index)); | 284 ASSERT(!name->AsArrayIndex(&element_index)); |
| 281 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes( | 285 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes( |
| 282 boilerplate, name, value, NONE, | 286 boilerplate, name, value, NONE, |
| 283 value_type, mode); | 287 value_type, mode); |
| 284 } | 288 } |
| 285 } else if (key->ToArrayIndex(&element_index)) { | 289 } else if (key->ToArrayIndex(&element_index)) { |
| 286 // Array index (uint32). | 290 // Array index (uint32). |
| 287 maybe_result = JSObject::SetOwnElement( | 291 if (value->IsUninitialized()) { |
| 288 boilerplate, element_index, value, SLOPPY); | 292 maybe_result = value; |
| 293 } else { |
| 294 maybe_result = JSObject::SetOwnElement( |
| 295 boilerplate, element_index, value, SLOPPY); |
| 296 } |
| 289 } else { | 297 } else { |
| 290 // Non-uint32 number. | 298 // Non-uint32 number. |
| 291 ASSERT(key->IsNumber()); | 299 ASSERT(key->IsNumber()); |
| 292 double num = key->Number(); | 300 double num = key->Number(); |
| 293 char arr[100]; | 301 char arr[100]; |
| 294 Vector<char> buffer(arr, ARRAY_SIZE(arr)); | 302 Vector<char> buffer(arr, ARRAY_SIZE(arr)); |
| 295 const char* str = DoubleToCString(num, buffer); | 303 const char* str = DoubleToCString(num, buffer); |
| 296 Handle<String> name = isolate->factory()->NewStringFromAsciiChecked(str); | 304 Handle<String> name = isolate->factory()->NewStringFromAsciiChecked(str); |
| 297 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes( | 305 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes( |
| 298 boilerplate, name, value, NONE, | 306 boilerplate, name, value, NONE, |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 Handle<Map> old_map(object->map()); | 2096 Handle<Map> old_map(object->map()); |
| 2089 RUNTIME_ASSERT(!old_map->is_access_check_needed()); | 2097 RUNTIME_ASSERT(!old_map->is_access_check_needed()); |
| 2090 // Copy map so it won't interfere constructor's initial map. | 2098 // Copy map so it won't interfere constructor's initial map. |
| 2091 Handle<Map> new_map = Map::Copy(old_map); | 2099 Handle<Map> new_map = Map::Copy(old_map); |
| 2092 new_map->set_is_access_check_needed(true); | 2100 new_map->set_is_access_check_needed(true); |
| 2093 JSObject::MigrateToMap(object, new_map); | 2101 JSObject::MigrateToMap(object, new_map); |
| 2094 return isolate->heap()->undefined_value(); | 2102 return isolate->heap()->undefined_value(); |
| 2095 } | 2103 } |
| 2096 | 2104 |
| 2097 | 2105 |
| 2098 // Transform getter or setter into something DefineAccessor can handle. | |
| 2099 static Handle<Object> InstantiateAccessorComponent(Isolate* isolate, | |
| 2100 Handle<Object> component) { | |
| 2101 if (component->IsUndefined()) return isolate->factory()->null_value(); | |
| 2102 Handle<FunctionTemplateInfo> info = | |
| 2103 Handle<FunctionTemplateInfo>::cast(component); | |
| 2104 return Utils::OpenHandle(*Utils::ToLocal(info)->GetFunction()); | |
| 2105 } | |
| 2106 | |
| 2107 | |
| 2108 RUNTIME_FUNCTION(Runtime_SetAccessorProperty) { | |
| 2109 HandleScope scope(isolate); | |
| 2110 ASSERT(args.length() == 5); | |
| 2111 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | |
| 2112 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | |
| 2113 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); | |
| 2114 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | |
| 2115 CONVERT_SMI_ARG_CHECKED(attribute, 4); | |
| 2116 RUNTIME_ASSERT(getter->IsUndefined() || getter->IsFunctionTemplateInfo()); | |
| 2117 RUNTIME_ASSERT(setter->IsUndefined() || setter->IsFunctionTemplateInfo()); | |
| 2118 RUNTIME_ASSERT(PropertyDetails::AttributesField::is_valid( | |
| 2119 static_cast<PropertyAttributes>(attribute))); | |
| 2120 JSObject::DefineAccessor(object, | |
| 2121 name, | |
| 2122 InstantiateAccessorComponent(isolate, getter), | |
| 2123 InstantiateAccessorComponent(isolate, setter), | |
| 2124 static_cast<PropertyAttributes>(attribute)); | |
| 2125 return isolate->heap()->undefined_value(); | |
| 2126 } | |
| 2127 | |
| 2128 | |
| 2129 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) { | 2106 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) { |
| 2130 HandleScope scope(isolate); | 2107 HandleScope scope(isolate); |
| 2131 Handle<Object> args[1] = { name }; | 2108 Handle<Object> args[1] = { name }; |
| 2132 Handle<Object> error = isolate->factory()->NewTypeError( | 2109 Handle<Object> error = isolate->factory()->NewTypeError( |
| 2133 "var_redeclaration", HandleVector(args, 1)); | 2110 "var_redeclaration", HandleVector(args, 1)); |
| 2134 return isolate->Throw(*error); | 2111 return isolate->Throw(*error); |
| 2135 } | 2112 } |
| 2136 | 2113 |
| 2137 | 2114 |
| 2138 RUNTIME_FUNCTION(RuntimeHidden_DeclareGlobals) { | 2115 RUNTIME_FUNCTION(RuntimeHidden_DeclareGlobals) { |
| (...skipping 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5030 return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull(); | 5007 return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull(); |
| 5031 } | 5008 } |
| 5032 | 5009 |
| 5033 | 5010 |
| 5034 // Implements part of 8.12.9 DefineOwnProperty. | 5011 // Implements part of 8.12.9 DefineOwnProperty. |
| 5035 // There are 3 cases that lead here: | 5012 // There are 3 cases that lead here: |
| 5036 // Step 4b - define a new accessor property. | 5013 // Step 4b - define a new accessor property. |
| 5037 // Steps 9c & 12 - replace an existing data property with an accessor property. | 5014 // Steps 9c & 12 - replace an existing data property with an accessor property. |
| 5038 // Step 12 - update an existing accessor property with an accessor or generic | 5015 // Step 12 - update an existing accessor property with an accessor or generic |
| 5039 // descriptor. | 5016 // descriptor. |
| 5040 RUNTIME_FUNCTION(Runtime_DefineOrRedefineAccessorProperty) { | 5017 RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) { |
| 5041 HandleScope scope(isolate); | 5018 HandleScope scope(isolate); |
| 5042 ASSERT(args.length() == 5); | 5019 ASSERT(args.length() == 5); |
| 5043 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 5020 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 5044 RUNTIME_ASSERT(!obj->IsNull()); | 5021 RUNTIME_ASSERT(!obj->IsNull()); |
| 5045 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 5022 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| 5046 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); | 5023 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); |
| 5047 RUNTIME_ASSERT(IsValidAccessor(getter)); | 5024 RUNTIME_ASSERT(IsValidAccessor(getter)); |
| 5048 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | 5025 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); |
| 5049 RUNTIME_ASSERT(IsValidAccessor(setter)); | 5026 RUNTIME_ASSERT(IsValidAccessor(setter)); |
| 5050 CONVERT_SMI_ARG_CHECKED(unchecked, 4); | 5027 CONVERT_SMI_ARG_CHECKED(unchecked, 4); |
| 5051 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5028 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 5052 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 5029 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 5053 | 5030 |
| 5054 bool fast = obj->HasFastProperties(); | 5031 bool fast = obj->HasFastProperties(); |
| 5055 // DefineAccessor checks access rights. | 5032 // DefineAccessor checks access rights. |
| 5056 JSObject::DefineAccessor(obj, name, getter, setter, attr); | 5033 JSObject::DefineAccessor(obj, name, getter, setter, attr); |
| 5057 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 5034 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5058 if (fast) JSObject::TransformToFastProperties(obj, 0); | 5035 if (fast) JSObject::TransformToFastProperties(obj, 0); |
| 5059 return isolate->heap()->undefined_value(); | 5036 return isolate->heap()->undefined_value(); |
| 5060 } | 5037 } |
| 5061 | 5038 |
| 5062 | 5039 |
| 5063 // Implements part of 8.12.9 DefineOwnProperty. | 5040 // Implements part of 8.12.9 DefineOwnProperty. |
| 5064 // There are 3 cases that lead here: | 5041 // There are 3 cases that lead here: |
| 5065 // Step 4a - define a new data property. | 5042 // Step 4a - define a new data property. |
| 5066 // Steps 9b & 12 - replace an existing accessor property with a data property. | 5043 // 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 | 5044 // Step 12 - update an existing data property with a data or generic |
| 5068 // descriptor. | 5045 // descriptor. |
| 5069 RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) { | 5046 RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) { |
| 5070 HandleScope scope(isolate); | 5047 HandleScope scope(isolate); |
| 5071 ASSERT(args.length() == 4); | 5048 ASSERT(args.length() == 4); |
| 5072 CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0); | 5049 CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0); |
| 5073 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 5050 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| 5074 CONVERT_ARG_HANDLE_CHECKED(Object, obj_value, 2); | 5051 CONVERT_ARG_HANDLE_CHECKED(Object, obj_value, 2); |
| 5075 CONVERT_SMI_ARG_CHECKED(unchecked, 3); | 5052 CONVERT_SMI_ARG_CHECKED(unchecked, 3); |
| 5076 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5053 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 5077 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 5054 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 5078 | 5055 |
| 5079 // Check access rights if needed. | 5056 // Check access rights if needed. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5117 ALLOW_AS_CONSTANT, | 5094 ALLOW_AS_CONSTANT, |
| 5118 JSReceiver::PERFORM_EXTENSIBILITY_CHECK, | 5095 JSReceiver::PERFORM_EXTENSIBILITY_CHECK, |
| 5119 JSReceiver::MAY_BE_STORE_FROM_KEYED, | 5096 JSReceiver::MAY_BE_STORE_FROM_KEYED, |
| 5120 JSObject::DONT_FORCE_FIELD)); | 5097 JSObject::DONT_FORCE_FIELD)); |
| 5121 return *result; | 5098 return *result; |
| 5122 } | 5099 } |
| 5123 | 5100 |
| 5124 Handle<Object> result; | 5101 Handle<Object> result; |
| 5125 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5102 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 5126 isolate, result, | 5103 isolate, result, |
| 5127 Runtime::ForceSetObjectProperty( | 5104 Runtime::DefineObjectProperty( |
| 5128 js_object, name, obj_value, attr, | 5105 js_object, name, obj_value, attr, |
| 5129 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)); | 5106 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)); |
| 5130 return *result; | 5107 return *result; |
| 5131 } | 5108 } |
| 5132 | 5109 |
| 5133 | 5110 |
| 5134 // Return property without being observable by accessors or interceptors. | 5111 // Return property without being observable by accessors or interceptors. |
| 5135 RUNTIME_FUNCTION(Runtime_GetDataProperty) { | 5112 RUNTIME_FUNCTION(Runtime_GetDataProperty) { |
| 5136 HandleScope scope(isolate); | 5113 HandleScope scope(isolate); |
| 5137 ASSERT(args.length() == 2); | 5114 ASSERT(args.length() == 2); |
| 5138 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 5115 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 5139 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 5116 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 5140 return *JSObject::GetDataProperty(object, key); | 5117 return *JSObject::GetDataProperty(object, key); |
| 5141 } | 5118 } |
| 5142 | 5119 |
| 5143 | 5120 |
| 5144 MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate, | 5121 MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate, |
| 5145 Handle<Object> object, | 5122 Handle<Object> object, |
| 5146 Handle<Object> key, | 5123 Handle<Object> key, |
| 5147 Handle<Object> value, | 5124 Handle<Object> value, |
| 5148 PropertyAttributes attr, | 5125 StrictMode strict_mode, |
| 5149 StrictMode strict_mode) { | 5126 PropertyAttributes attrs) { |
| 5150 SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY; | |
| 5151 | |
| 5152 if (object->IsUndefined() || object->IsNull()) { | 5127 if (object->IsUndefined() || object->IsNull()) { |
| 5153 Handle<Object> args[2] = { key, object }; | 5128 Handle<Object> args[2] = { key, object }; |
| 5154 Handle<Object> error = | 5129 Handle<Object> error = |
| 5155 isolate->factory()->NewTypeError("non_object_property_store", | 5130 isolate->factory()->NewTypeError("non_object_property_store", |
| 5156 HandleVector(args, 2)); | 5131 HandleVector(args, 2)); |
| 5157 return isolate->Throw<Object>(error); | 5132 return isolate->Throw<Object>(error); |
| 5158 } | 5133 } |
| 5159 | 5134 |
| 5160 if (object->IsJSProxy()) { | 5135 if (object->IsJSProxy()) { |
| 5161 Handle<Object> name_object; | 5136 Handle<Object> name_object; |
| 5162 if (key->IsSymbol()) { | 5137 if (key->IsSymbol()) { |
| 5163 name_object = key; | 5138 name_object = key; |
| 5164 } else { | 5139 } else { |
| 5165 ASSIGN_RETURN_ON_EXCEPTION( | 5140 ASSIGN_RETURN_ON_EXCEPTION( |
| 5166 isolate, name_object, Execution::ToString(isolate, key), Object); | 5141 isolate, name_object, Execution::ToString(isolate, key), Object); |
| 5167 } | 5142 } |
| 5168 Handle<Name> name = Handle<Name>::cast(name_object); | 5143 Handle<Name> name = Handle<Name>::cast(name_object); |
| 5169 return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value, | 5144 return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value, |
| 5170 attr, | 5145 attrs, strict_mode); |
| 5171 strict_mode); | |
| 5172 } | 5146 } |
| 5173 | 5147 |
| 5174 // If the object isn't a JavaScript object, we ignore the store. | 5148 // If the object isn't a JavaScript object, we ignore the store. |
| 5175 if (!object->IsJSObject()) return value; | 5149 if (!object->IsJSObject()) return value; |
| 5176 | 5150 |
| 5177 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 5151 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
| 5178 | 5152 |
| 5179 // Check if the given key is an array index. | 5153 // Check if the given key is an array index. |
| 5180 uint32_t index; | 5154 uint32_t index; |
| 5181 if (key->ToArrayIndex(&index)) { | 5155 if (key->ToArrayIndex(&index)) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5193 JSObject::ValidateElements(js_object); | 5167 JSObject::ValidateElements(js_object); |
| 5194 if (js_object->HasExternalArrayElements() || | 5168 if (js_object->HasExternalArrayElements() || |
| 5195 js_object->HasFixedTypedArrayElements()) { | 5169 js_object->HasFixedTypedArrayElements()) { |
| 5196 if (!value->IsNumber() && !value->IsUndefined()) { | 5170 if (!value->IsNumber() && !value->IsUndefined()) { |
| 5197 ASSIGN_RETURN_ON_EXCEPTION( | 5171 ASSIGN_RETURN_ON_EXCEPTION( |
| 5198 isolate, value, Execution::ToNumber(isolate, value), Object); | 5172 isolate, value, Execution::ToNumber(isolate, value), Object); |
| 5199 } | 5173 } |
| 5200 } | 5174 } |
| 5201 | 5175 |
| 5202 MaybeHandle<Object> result = JSObject::SetElement( | 5176 MaybeHandle<Object> result = JSObject::SetElement( |
| 5203 js_object, index, value, attr, strict_mode, true, set_mode); | 5177 js_object, index, value, attrs, strict_mode, true, SET_PROPERTY); |
| 5204 JSObject::ValidateElements(js_object); | 5178 JSObject::ValidateElements(js_object); |
| 5205 | 5179 |
| 5206 return result.is_null() ? result : value; | 5180 return result.is_null() ? result : value; |
| 5207 } | 5181 } |
| 5208 | 5182 |
| 5209 if (key->IsName()) { | 5183 if (key->IsName()) { |
| 5210 Handle<Name> name = Handle<Name>::cast(key); | 5184 Handle<Name> name = Handle<Name>::cast(key); |
| 5211 if (name->AsArrayIndex(&index)) { | 5185 if (name->AsArrayIndex(&index)) { |
| 5212 if (js_object->HasExternalArrayElements()) { | 5186 if (js_object->HasExternalArrayElements()) { |
| 5213 if (!value->IsNumber() && !value->IsUndefined()) { | 5187 if (!value->IsNumber() && !value->IsUndefined()) { |
| 5214 ASSIGN_RETURN_ON_EXCEPTION( | 5188 ASSIGN_RETURN_ON_EXCEPTION( |
| 5215 isolate, value, Execution::ToNumber(isolate, value), Object); | 5189 isolate, value, Execution::ToNumber(isolate, value), Object); |
| 5216 } | 5190 } |
| 5217 } | 5191 } |
| 5218 return JSObject::SetElement(js_object, index, value, attr, | 5192 return JSObject::SetElement(js_object, index, value, attrs, |
| 5219 strict_mode, true, set_mode); | 5193 strict_mode, true, SET_PROPERTY); |
| 5220 } else { | 5194 } else { |
| 5221 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); | 5195 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); |
| 5222 return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode); | 5196 return JSReceiver::SetProperty( |
| 5197 js_object, name, value, attrs, strict_mode); |
| 5223 } | 5198 } |
| 5224 } | 5199 } |
| 5225 | 5200 |
| 5226 // Call-back into JavaScript to convert the key to a string. | 5201 // Call-back into JavaScript to convert the key to a string. |
| 5227 Handle<Object> converted; | 5202 Handle<Object> converted; |
| 5228 ASSIGN_RETURN_ON_EXCEPTION( | 5203 ASSIGN_RETURN_ON_EXCEPTION( |
| 5229 isolate, converted, Execution::ToString(isolate, key), Object); | 5204 isolate, converted, Execution::ToString(isolate, key), Object); |
| 5230 Handle<String> name = Handle<String>::cast(converted); | 5205 Handle<String> name = Handle<String>::cast(converted); |
| 5231 | 5206 |
| 5232 if (name->AsArrayIndex(&index)) { | 5207 if (name->AsArrayIndex(&index)) { |
| 5233 return JSObject::SetElement(js_object, index, value, attr, | 5208 return JSObject::SetElement(js_object, index, value, attrs, |
| 5234 strict_mode, true, set_mode); | 5209 strict_mode, true, SET_PROPERTY); |
| 5235 } else { | 5210 } else { |
| 5236 return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode); | 5211 return JSReceiver::SetProperty(js_object, name, value, attrs, strict_mode); |
| 5237 } | 5212 } |
| 5238 } | 5213 } |
| 5239 | 5214 |
| 5240 | 5215 |
| 5241 MaybeHandle<Object> Runtime::ForceSetObjectProperty( | 5216 MaybeHandle<Object> Runtime::DefineObjectProperty( |
| 5242 Handle<JSObject> js_object, | 5217 Handle<JSObject> js_object, |
| 5243 Handle<Object> key, | 5218 Handle<Object> key, |
| 5244 Handle<Object> value, | 5219 Handle<Object> value, |
| 5245 PropertyAttributes attr, | 5220 PropertyAttributes attr, |
| 5246 JSReceiver::StoreFromKeyed store_from_keyed) { | 5221 JSReceiver::StoreFromKeyed store_from_keyed) { |
| 5247 Isolate* isolate = js_object->GetIsolate(); | 5222 Isolate* isolate = js_object->GetIsolate(); |
| 5248 // Check if the given key is an array index. | 5223 // Check if the given key is an array index. |
| 5249 uint32_t index; | 5224 uint32_t index; |
| 5250 if (key->ToArrayIndex(&index)) { | 5225 if (key->ToArrayIndex(&index)) { |
| 5251 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters | 5226 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5336 RUNTIME_ASSERT(args.length() == 3); | 5311 RUNTIME_ASSERT(args.length() == 3); |
| 5337 | 5312 |
| 5338 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 5313 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 5339 CONVERT_ARG_HANDLE_CHECKED(String, key, 1); | 5314 CONVERT_ARG_HANDLE_CHECKED(String, key, 1); |
| 5340 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 5315 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| 5341 RUNTIME_ASSERT(key->IsUniqueName()); | 5316 RUNTIME_ASSERT(key->IsUniqueName()); |
| 5342 return *JSObject::SetHiddenProperty(object, key, value); | 5317 return *JSObject::SetHiddenProperty(object, key, value); |
| 5343 } | 5318 } |
| 5344 | 5319 |
| 5345 | 5320 |
| 5346 RUNTIME_FUNCTION(Runtime_SetProperty) { | 5321 RUNTIME_FUNCTION(Runtime_AddProperty) { |
| 5347 HandleScope scope(isolate); | 5322 HandleScope scope(isolate); |
| 5348 RUNTIME_ASSERT(args.length() == 4 || args.length() == 5); | 5323 RUNTIME_ASSERT(args.length() == 4); |
| 5349 | 5324 |
| 5350 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 5325 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 5351 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 5326 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
| 5352 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 5327 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| 5353 CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3); | 5328 CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3); |
| 5354 RUNTIME_ASSERT( | 5329 RUNTIME_ASSERT( |
| 5355 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5330 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 5356 // Compute attributes. | 5331 // Compute attributes. |
| 5357 PropertyAttributes attributes = | 5332 PropertyAttributes attributes = |
| 5358 static_cast<PropertyAttributes>(unchecked_attributes); | 5333 static_cast<PropertyAttributes>(unchecked_attributes); |
| 5359 | 5334 |
| 5360 StrictMode strict_mode = SLOPPY; | 5335 #ifdef DEBUG |
| 5361 if (args.length() == 5) { | 5336 if (key->IsName()) { |
| 5362 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_arg, 4); | 5337 LookupIterator it(object, Handle<Name>::cast(key), |
| 5363 strict_mode = strict_mode_arg; | 5338 LookupIterator::CHECK_OWN); |
| 5339 JSReceiver::GetPropertyAttributes(&it); |
| 5340 RUNTIME_ASSERT(!it.IsFound()); |
| 5341 } else { |
| 5342 uint32_t index = 0; |
| 5343 RUNTIME_ASSERT(key->ToArrayIndex(&index)); |
| 5344 RUNTIME_ASSERT(!JSReceiver::HasOwnElement(object, index)); |
| 5364 } | 5345 } |
| 5346 #endif |
| 5365 | 5347 |
| 5366 Handle<Object> result; | 5348 Handle<Object> result; |
| 5367 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5349 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 5368 isolate, result, | 5350 isolate, result, |
| 5369 Runtime::SetObjectProperty( | 5351 Runtime::DefineObjectProperty(object, key, value, attributes)); |
| 5370 isolate, object, key, value, attributes, strict_mode)); | |
| 5371 return *result; | 5352 return *result; |
| 5372 } | 5353 } |
| 5373 | 5354 |
| 5355 |
| 5356 RUNTIME_FUNCTION(Runtime_SetProperty) { |
| 5357 HandleScope scope(isolate); |
| 5358 RUNTIME_ASSERT(args.length() == 4); |
| 5359 |
| 5360 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 5361 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
| 5362 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| 5363 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_arg, 3); |
| 5364 StrictMode strict_mode = strict_mode_arg; |
| 5365 |
| 5366 Handle<Object> result; |
| 5367 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 5368 isolate, result, |
| 5369 Runtime::SetObjectProperty(isolate, object, key, value, strict_mode)); |
| 5370 return *result; |
| 5371 } |
| 5372 |
| 5374 | 5373 |
| 5375 RUNTIME_FUNCTION(Runtime_TransitionElementsKind) { | 5374 RUNTIME_FUNCTION(Runtime_TransitionElementsKind) { |
| 5376 HandleScope scope(isolate); | 5375 HandleScope scope(isolate); |
| 5377 RUNTIME_ASSERT(args.length() == 2); | 5376 RUNTIME_ASSERT(args.length() == 2); |
| 5378 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 5377 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
| 5379 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); | 5378 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); |
| 5380 JSObject::TransitionElementsKind(array, map->elements_kind()); | 5379 JSObject::TransitionElementsKind(array, map->elements_kind()); |
| 5381 return *array; | 5380 return *array; |
| 5382 } | 5381 } |
| 5383 | 5382 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5514 | 5513 |
| 5515 | 5514 |
| 5516 RUNTIME_FUNCTION(Runtime_DebugPromiseHandleEpilogue) { | 5515 RUNTIME_FUNCTION(Runtime_DebugPromiseHandleEpilogue) { |
| 5517 ASSERT(args.length() == 0); | 5516 ASSERT(args.length() == 0); |
| 5518 SealHandleScope shs(isolate); | 5517 SealHandleScope shs(isolate); |
| 5519 isolate->debug()->PromiseHandleEpilogue(); | 5518 isolate->debug()->PromiseHandleEpilogue(); |
| 5520 return isolate->heap()->undefined_value(); | 5519 return isolate->heap()->undefined_value(); |
| 5521 } | 5520 } |
| 5522 | 5521 |
| 5523 | 5522 |
| 5524 // Set an own property, even if it is READ_ONLY. If the property does not | |
| 5525 // exist, it will be added with attributes NONE. | |
| 5526 RUNTIME_FUNCTION(Runtime_IgnoreAttributesAndSetProperty) { | |
| 5527 HandleScope scope(isolate); | |
| 5528 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); | |
| 5529 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | |
| 5530 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | |
| 5531 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | |
| 5532 // Compute attributes. | |
| 5533 PropertyAttributes attributes = NONE; | |
| 5534 if (args.length() == 4) { | |
| 5535 CONVERT_SMI_ARG_CHECKED(unchecked_value, 3); | |
| 5536 // Only attribute bits should be set. | |
| 5537 RUNTIME_ASSERT( | |
| 5538 (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | |
| 5539 attributes = static_cast<PropertyAttributes>(unchecked_value); | |
| 5540 } | |
| 5541 Handle<Object> result; | |
| 5542 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
| 5543 isolate, result, | |
| 5544 JSObject::SetOwnPropertyIgnoreAttributes( | |
| 5545 object, name, value, attributes)); | |
| 5546 return *result; | |
| 5547 } | |
| 5548 | |
| 5549 | |
| 5550 RUNTIME_FUNCTION(Runtime_DeleteProperty) { | 5523 RUNTIME_FUNCTION(Runtime_DeleteProperty) { |
| 5551 HandleScope scope(isolate); | 5524 HandleScope scope(isolate); |
| 5552 ASSERT(args.length() == 3); | 5525 ASSERT(args.length() == 3); |
| 5553 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 5526 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 5554 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 5527 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 5555 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); | 5528 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); |
| 5556 JSReceiver::DeleteMode delete_mode = strict_mode == STRICT | 5529 JSReceiver::DeleteMode delete_mode = strict_mode == STRICT |
| 5557 ? JSReceiver::STRICT_DELETION : JSReceiver::NORMAL_DELETION; | 5530 ? JSReceiver::STRICT_DELETION : JSReceiver::NORMAL_DELETION; |
| 5558 Handle<Object> result; | 5531 Handle<Object> result; |
| 5559 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5532 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| (...skipping 5837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11397 | 11370 |
| 11398 HandleScope scope(isolate); | 11371 HandleScope scope(isolate); |
| 11399 Handle<Object> value(i < frame_inspector->GetParametersCount() | 11372 Handle<Object> value(i < frame_inspector->GetParametersCount() |
| 11400 ? frame_inspector->GetParameter(i) | 11373 ? frame_inspector->GetParameter(i) |
| 11401 : isolate->heap()->undefined_value(), | 11374 : isolate->heap()->undefined_value(), |
| 11402 isolate); | 11375 isolate); |
| 11403 ASSERT(!value->IsTheHole()); | 11376 ASSERT(!value->IsTheHole()); |
| 11404 | 11377 |
| 11405 RETURN_ON_EXCEPTION( | 11378 RETURN_ON_EXCEPTION( |
| 11406 isolate, | 11379 isolate, |
| 11407 Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY), | 11380 Runtime::SetObjectProperty(isolate, target, name, value, SLOPPY), |
| 11408 JSObject); | 11381 JSObject); |
| 11409 } | 11382 } |
| 11410 | 11383 |
| 11411 // Second fill all stack locals. | 11384 // Second fill all stack locals. |
| 11412 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { | 11385 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { |
| 11413 if (scope_info->LocalIsSynthetic(i)) continue; | 11386 if (scope_info->LocalIsSynthetic(i)) continue; |
| 11414 Handle<String> name(scope_info->StackLocalName(i)); | 11387 Handle<String> name(scope_info->StackLocalName(i)); |
| 11415 Handle<Object> value(frame_inspector->GetExpression(i), isolate); | 11388 Handle<Object> value(frame_inspector->GetExpression(i), isolate); |
| 11416 if (value->IsTheHole()) continue; | 11389 if (value->IsTheHole()) continue; |
| 11417 | 11390 |
| 11418 RETURN_ON_EXCEPTION( | 11391 RETURN_ON_EXCEPTION( |
| 11419 isolate, | 11392 isolate, |
| 11420 Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY), | 11393 Runtime::SetObjectProperty(isolate, target, name, value, SLOPPY), |
| 11421 JSObject); | 11394 JSObject); |
| 11422 } | 11395 } |
| 11423 | 11396 |
| 11424 return target; | 11397 return target; |
| 11425 } | 11398 } |
| 11426 | 11399 |
| 11427 | 11400 |
| 11428 static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, | 11401 static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, |
| 11429 Handle<JSObject> target, | 11402 Handle<JSObject> target, |
| 11430 Handle<JSFunction> function, | 11403 Handle<JSFunction> function, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11499 | 11472 |
| 11500 for (int i = 0; i < keys->length(); i++) { | 11473 for (int i = 0; i < keys->length(); i++) { |
| 11501 // Names of variables introduced by eval are strings. | 11474 // Names of variables introduced by eval are strings. |
| 11502 ASSERT(keys->get(i)->IsString()); | 11475 ASSERT(keys->get(i)->IsString()); |
| 11503 Handle<String> key(String::cast(keys->get(i))); | 11476 Handle<String> key(String::cast(keys->get(i))); |
| 11504 Handle<Object> value; | 11477 Handle<Object> value; |
| 11505 ASSIGN_RETURN_ON_EXCEPTION( | 11478 ASSIGN_RETURN_ON_EXCEPTION( |
| 11506 isolate, value, Object::GetPropertyOrElement(ext, key), JSObject); | 11479 isolate, value, Object::GetPropertyOrElement(ext, key), JSObject); |
| 11507 RETURN_ON_EXCEPTION( | 11480 RETURN_ON_EXCEPTION( |
| 11508 isolate, | 11481 isolate, |
| 11509 Runtime::SetObjectProperty( | 11482 Runtime::SetObjectProperty(isolate, target, key, value, SLOPPY), |
| 11510 isolate, target, key, value, NONE, SLOPPY), | |
| 11511 JSObject); | 11483 JSObject); |
| 11512 } | 11484 } |
| 11513 } | 11485 } |
| 11514 } | 11486 } |
| 11515 | 11487 |
| 11516 return target; | 11488 return target; |
| 11517 } | 11489 } |
| 11518 | 11490 |
| 11519 | 11491 |
| 11520 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeLocalScope( | 11492 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeLocalScope( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11605 // Function context extension. These are variables introduced by eval. | 11577 // Function context extension. These are variables introduced by eval. |
| 11606 if (function_context->closure() == *function) { | 11578 if (function_context->closure() == *function) { |
| 11607 if (function_context->has_extension() && | 11579 if (function_context->has_extension() && |
| 11608 !function_context->IsNativeContext()) { | 11580 !function_context->IsNativeContext()) { |
| 11609 Handle<JSObject> ext(JSObject::cast(function_context->extension())); | 11581 Handle<JSObject> ext(JSObject::cast(function_context->extension())); |
| 11610 | 11582 |
| 11611 if (JSReceiver::HasProperty(ext, variable_name)) { | 11583 if (JSReceiver::HasProperty(ext, variable_name)) { |
| 11612 // We don't expect this to do anything except replacing | 11584 // We don't expect this to do anything except replacing |
| 11613 // property value. | 11585 // property value. |
| 11614 Runtime::SetObjectProperty(isolate, ext, variable_name, new_value, | 11586 Runtime::SetObjectProperty(isolate, ext, variable_name, new_value, |
| 11615 NONE, SLOPPY).Assert(); | 11587 SLOPPY).Assert(); |
| 11616 return true; | 11588 return true; |
| 11617 } | 11589 } |
| 11618 } | 11590 } |
| 11619 } | 11591 } |
| 11620 } | 11592 } |
| 11621 | 11593 |
| 11622 return default_result; | 11594 return default_result; |
| 11623 } | 11595 } |
| 11624 | 11596 |
| 11625 | 11597 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 11656 for (int i = 0; i < keys->length(); i++) { | 11628 for (int i = 0; i < keys->length(); i++) { |
| 11657 HandleScope scope(isolate); | 11629 HandleScope scope(isolate); |
| 11658 // Names of variables introduced by eval are strings. | 11630 // Names of variables introduced by eval are strings. |
| 11659 ASSERT(keys->get(i)->IsString()); | 11631 ASSERT(keys->get(i)->IsString()); |
| 11660 Handle<String> key(String::cast(keys->get(i))); | 11632 Handle<String> key(String::cast(keys->get(i))); |
| 11661 Handle<Object> value; | 11633 Handle<Object> value; |
| 11662 ASSIGN_RETURN_ON_EXCEPTION( | 11634 ASSIGN_RETURN_ON_EXCEPTION( |
| 11663 isolate, value, Object::GetPropertyOrElement(ext, key), JSObject); | 11635 isolate, value, Object::GetPropertyOrElement(ext, key), JSObject); |
| 11664 RETURN_ON_EXCEPTION( | 11636 RETURN_ON_EXCEPTION( |
| 11665 isolate, | 11637 isolate, |
| 11666 Runtime::SetObjectProperty( | 11638 Runtime::DefineObjectProperty(closure_scope, key, value, NONE), |
| 11667 isolate, closure_scope, key, value, NONE, SLOPPY), | |
| 11668 JSObject); | 11639 JSObject); |
| 11669 } | 11640 } |
| 11670 } | 11641 } |
| 11671 | 11642 |
| 11672 return closure_scope; | 11643 return closure_scope; |
| 11673 } | 11644 } |
| 11674 | 11645 |
| 11675 | 11646 |
| 11676 // This method copies structure of MaterializeClosure method above. | 11647 // This method copies structure of MaterializeClosure method above. |
| 11677 static bool SetClosureVariableValue(Isolate* isolate, | 11648 static bool SetClosureVariableValue(Isolate* isolate, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 11688 isolate, scope_info, context, variable_name, new_value)) { | 11659 isolate, scope_info, context, variable_name, new_value)) { |
| 11689 return true; | 11660 return true; |
| 11690 } | 11661 } |
| 11691 | 11662 |
| 11692 // Properties from the function context extension. This will | 11663 // Properties from the function context extension. This will |
| 11693 // be variables introduced by eval. | 11664 // be variables introduced by eval. |
| 11694 if (context->has_extension()) { | 11665 if (context->has_extension()) { |
| 11695 Handle<JSObject> ext(JSObject::cast(context->extension())); | 11666 Handle<JSObject> ext(JSObject::cast(context->extension())); |
| 11696 if (JSReceiver::HasProperty(ext, variable_name)) { | 11667 if (JSReceiver::HasProperty(ext, variable_name)) { |
| 11697 // We don't expect this to do anything except replacing property value. | 11668 // We don't expect this to do anything except replacing property value. |
| 11698 Runtime::SetObjectProperty(isolate, ext, variable_name, new_value, | 11669 Runtime::DefineObjectProperty( |
| 11699 NONE, SLOPPY).Assert(); | 11670 ext, variable_name, new_value, NONE).Assert(); |
| 11700 return true; | 11671 return true; |
| 11701 } | 11672 } |
| 11702 } | 11673 } |
| 11703 | 11674 |
| 11704 return false; | 11675 return false; |
| 11705 } | 11676 } |
| 11706 | 11677 |
| 11707 | 11678 |
| 11708 // Create a plain JSObject which materializes the scope for the specified | 11679 // Create a plain JSObject which materializes the scope for the specified |
| 11709 // catch context. | 11680 // catch context. |
| 11710 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeCatchScope( | 11681 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeCatchScope( |
| 11711 Isolate* isolate, | 11682 Isolate* isolate, |
| 11712 Handle<Context> context) { | 11683 Handle<Context> context) { |
| 11713 ASSERT(context->IsCatchContext()); | 11684 ASSERT(context->IsCatchContext()); |
| 11714 Handle<String> name(String::cast(context->extension())); | 11685 Handle<String> name(String::cast(context->extension())); |
| 11715 Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX), | 11686 Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX), |
| 11716 isolate); | 11687 isolate); |
| 11717 Handle<JSObject> catch_scope = | 11688 Handle<JSObject> catch_scope = |
| 11718 isolate->factory()->NewJSObject(isolate->object_function()); | 11689 isolate->factory()->NewJSObject(isolate->object_function()); |
| 11719 RETURN_ON_EXCEPTION( | 11690 RETURN_ON_EXCEPTION( |
| 11720 isolate, | 11691 isolate, |
| 11721 Runtime::SetObjectProperty(isolate, catch_scope, name, thrown_object, | 11692 Runtime::DefineObjectProperty(catch_scope, name, thrown_object, NONE), |
| 11722 NONE, SLOPPY), | |
| 11723 JSObject); | 11693 JSObject); |
| 11724 return catch_scope; | 11694 return catch_scope; |
| 11725 } | 11695 } |
| 11726 | 11696 |
| 11727 | 11697 |
| 11728 static bool SetCatchVariableValue(Isolate* isolate, | 11698 static bool SetCatchVariableValue(Isolate* isolate, |
| 11729 Handle<Context> context, | 11699 Handle<Context> context, |
| 11730 Handle<String> variable_name, | 11700 Handle<String> variable_name, |
| 11731 Handle<Object> new_value) { | 11701 Handle<Object> new_value) { |
| 11732 ASSERT(context->IsCatchContext()); | 11702 ASSERT(context->IsCatchContext()); |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12775 target, isolate->factory()->arguments_string())) { | 12745 target, isolate->factory()->arguments_string())) { |
| 12776 return target; | 12746 return target; |
| 12777 } | 12747 } |
| 12778 | 12748 |
| 12779 // FunctionGetArguments can't throw an exception. | 12749 // FunctionGetArguments can't throw an exception. |
| 12780 Handle<JSObject> arguments = Handle<JSObject>::cast( | 12750 Handle<JSObject> arguments = Handle<JSObject>::cast( |
| 12781 Accessors::FunctionGetArguments(function)); | 12751 Accessors::FunctionGetArguments(function)); |
| 12782 Handle<String> arguments_str = isolate->factory()->arguments_string(); | 12752 Handle<String> arguments_str = isolate->factory()->arguments_string(); |
| 12783 RETURN_ON_EXCEPTION( | 12753 RETURN_ON_EXCEPTION( |
| 12784 isolate, | 12754 isolate, |
| 12785 Runtime::SetObjectProperty( | 12755 Runtime::DefineObjectProperty(target, arguments_str, arguments, NONE), |
| 12786 isolate, target, arguments_str, arguments, ::NONE, SLOPPY), | |
| 12787 JSObject); | 12756 JSObject); |
| 12788 return target; | 12757 return target; |
| 12789 } | 12758 } |
| 12790 | 12759 |
| 12791 | 12760 |
| 12792 // Compile and evaluate source for the given context. | 12761 // Compile and evaluate source for the given context. |
| 12793 static MaybeHandle<Object> DebugEvaluate(Isolate* isolate, | 12762 static MaybeHandle<Object> DebugEvaluate(Isolate* isolate, |
| 12794 Handle<Context> context, | 12763 Handle<Context> context, |
| 12795 Handle<Object> context_extension, | 12764 Handle<Object> context_extension, |
| 12796 Handle<Object> receiver, | 12765 Handle<Object> receiver, |
| (...skipping 2312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15109 } | 15078 } |
| 15110 return NULL; | 15079 return NULL; |
| 15111 } | 15080 } |
| 15112 | 15081 |
| 15113 | 15082 |
| 15114 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15083 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15115 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15084 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15116 } | 15085 } |
| 15117 | 15086 |
| 15118 } } // namespace v8::internal | 15087 } } // namespace v8::internal |
| OLD | NEW |