| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4917 } else { | 4917 } else { |
| 4918 bool has_pending_exception = false; | 4918 bool has_pending_exception = false; |
| 4919 Handle<Object> converted = | 4919 Handle<Object> converted = |
| 4920 Execution::ToString(isolate, key, &has_pending_exception); | 4920 Execution::ToString(isolate, key, &has_pending_exception); |
| 4921 if (has_pending_exception) return Handle<Name>(); | 4921 if (has_pending_exception) return Handle<Name>(); |
| 4922 return Handle<Name>::cast(converted); | 4922 return Handle<Name>::cast(converted); |
| 4923 } | 4923 } |
| 4924 } | 4924 } |
| 4925 | 4925 |
| 4926 | 4926 |
| 4927 MaybeObject* Runtime::HasObjectProperty(Isolate* isolate, | 4927 MaybeHandle<Object> Runtime::HasObjectProperty(Isolate* isolate, |
| 4928 Handle<JSReceiver> object, | 4928 Handle<JSReceiver> object, |
| 4929 Handle<Object> key) { | 4929 Handle<Object> key) { |
| 4930 HandleScope scope(isolate); | |
| 4931 | |
| 4932 // Check if the given key is an array index. | 4930 // Check if the given key is an array index. |
| 4933 uint32_t index; | 4931 uint32_t index; |
| 4934 if (key->ToArrayIndex(&index)) { | 4932 if (key->ToArrayIndex(&index)) { |
| 4935 return isolate->heap()->ToBoolean(JSReceiver::HasElement(object, index)); | 4933 return isolate->factory()->ToBoolean(JSReceiver::HasElement(object, index)); |
| 4936 } | 4934 } |
| 4937 | 4935 |
| 4938 // Convert the key to a name - possibly by calling back into JavaScript. | 4936 // Convert the key to a name - possibly by calling back into JavaScript. |
| 4939 Handle<Name> name = ToName(isolate, key); | 4937 Handle<Name> name = ToName(isolate, key); |
| 4940 RETURN_IF_EMPTY_HANDLE(isolate, name); | 4938 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, name, MaybeHandle<Object>()); |
| 4941 | 4939 |
| 4942 return isolate->heap()->ToBoolean(JSReceiver::HasProperty(object, name)); | 4940 return isolate->factory()->ToBoolean(JSReceiver::HasProperty(object, name)); |
| 4943 } | 4941 } |
| 4944 | 4942 |
| 4945 | 4943 |
| 4946 Handle<Object> Runtime::GetObjectProperty(Isolate* isolate, | 4944 Handle<Object> Runtime::GetObjectProperty(Isolate* isolate, |
| 4947 Handle<Object> object, | 4945 Handle<Object> object, |
| 4948 Handle<Object> key) { | 4946 Handle<Object> key) { |
| 4949 if (object->IsUndefined() || object->IsNull()) { | 4947 if (object->IsUndefined() || object->IsNull()) { |
| 4950 Handle<Object> args[2] = { key, object }; | 4948 Handle<Object> args[2] = { key, object }; |
| 4951 isolate->Throw(*isolate->factory()->NewTypeError("non_object_property_load", | 4949 isolate->Throw(*isolate->factory()->NewTypeError("non_object_property_load", |
| 4952 HandleVector(args, 2))); | 4950 HandleVector(args, 2))); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5245 isolate->factory()->NewTypeError("non_object_property_store", | 5243 isolate->factory()->NewTypeError("non_object_property_store", |
| 5246 HandleVector(args, 2)); | 5244 HandleVector(args, 2)); |
| 5247 isolate->Throw(*error); | 5245 isolate->Throw(*error); |
| 5248 return Handle<Object>(); | 5246 return Handle<Object>(); |
| 5249 } | 5247 } |
| 5250 | 5248 |
| 5251 if (object->IsJSProxy()) { | 5249 if (object->IsJSProxy()) { |
| 5252 bool has_pending_exception = false; | 5250 bool has_pending_exception = false; |
| 5253 Handle<Object> name_object = key->IsSymbol() | 5251 Handle<Object> name_object = key->IsSymbol() |
| 5254 ? key : Execution::ToString(isolate, key, &has_pending_exception); | 5252 ? key : Execution::ToString(isolate, key, &has_pending_exception); |
| 5255 if (has_pending_exception) return Handle<Object>(); // exception | 5253 if (has_pending_exception) return MaybeHandle<Object>(); // exception |
| 5256 Handle<Name> name = Handle<Name>::cast(name_object); | 5254 Handle<Name> name = Handle<Name>::cast(name_object); |
| 5257 return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value, | 5255 return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value, |
| 5258 attr, | 5256 attr, |
| 5259 strict_mode); | 5257 strict_mode); |
| 5260 } | 5258 } |
| 5261 | 5259 |
| 5262 // If the object isn't a JavaScript object, we ignore the store. | 5260 // If the object isn't a JavaScript object, we ignore the store. |
| 5263 if (!object->IsJSObject()) return value; | 5261 if (!object->IsJSObject()) return value; |
| 5264 | 5262 |
| 5265 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 5263 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5278 return value; | 5276 return value; |
| 5279 } | 5277 } |
| 5280 | 5278 |
| 5281 JSObject::ValidateElements(js_object); | 5279 JSObject::ValidateElements(js_object); |
| 5282 if (js_object->HasExternalArrayElements() || | 5280 if (js_object->HasExternalArrayElements() || |
| 5283 js_object->HasFixedTypedArrayElements()) { | 5281 js_object->HasFixedTypedArrayElements()) { |
| 5284 if (!value->IsNumber() && !value->IsUndefined()) { | 5282 if (!value->IsNumber() && !value->IsUndefined()) { |
| 5285 bool has_exception; | 5283 bool has_exception; |
| 5286 Handle<Object> number = | 5284 Handle<Object> number = |
| 5287 Execution::ToNumber(isolate, value, &has_exception); | 5285 Execution::ToNumber(isolate, value, &has_exception); |
| 5288 if (has_exception) return Handle<Object>(); // exception | 5286 if (has_exception) return MaybeHandle<Object>(); // exception |
| 5289 value = number; | 5287 value = number; |
| 5290 } | 5288 } |
| 5291 } | 5289 } |
| 5292 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, | 5290 |
| 5293 strict_mode, | 5291 MaybeHandle<Object> result = JSObject::SetElement( |
| 5294 true, | 5292 js_object, index, value, attr, strict_mode, true, set_mode); |
| 5295 set_mode); | |
| 5296 JSObject::ValidateElements(js_object); | 5293 JSObject::ValidateElements(js_object); |
| 5294 |
| 5297 return result.is_null() ? result : value; | 5295 return result.is_null() ? result : value; |
| 5298 } | 5296 } |
| 5299 | 5297 |
| 5300 if (key->IsName()) { | 5298 if (key->IsName()) { |
| 5301 Handle<Name> name = Handle<Name>::cast(key); | 5299 Handle<Name> name = Handle<Name>::cast(key); |
| 5302 if (name->AsArrayIndex(&index)) { | 5300 if (name->AsArrayIndex(&index)) { |
| 5303 if (js_object->HasExternalArrayElements()) { | 5301 if (js_object->HasExternalArrayElements()) { |
| 5304 if (!value->IsNumber() && !value->IsUndefined()) { | 5302 if (!value->IsNumber() && !value->IsUndefined()) { |
| 5305 bool has_exception; | 5303 bool has_exception; |
| 5306 Handle<Object> number = | 5304 Handle<Object> number = |
| 5307 Execution::ToNumber(isolate, value, &has_exception); | 5305 Execution::ToNumber(isolate, value, &has_exception); |
| 5308 if (has_exception) return Handle<Object>(); // exception | 5306 if (has_exception) return MaybeHandle<Object>(); // exception |
| 5309 value = number; | 5307 value = number; |
| 5310 } | 5308 } |
| 5311 } | 5309 } |
| 5312 return JSObject::SetElement(js_object, index, value, attr, strict_mode, | 5310 return JSObject::SetElement(js_object, index, value, attr, |
| 5313 true, | 5311 strict_mode, true, set_mode); |
| 5314 set_mode); | |
| 5315 } else { | 5312 } else { |
| 5316 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5313 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
| 5317 return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode); | 5314 return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode); |
| 5318 } | 5315 } |
| 5319 } | 5316 } |
| 5320 | 5317 |
| 5321 // Call-back into JavaScript to convert the key to a string. | 5318 // Call-back into JavaScript to convert the key to a string. |
| 5322 bool has_pending_exception = false; | 5319 bool has_pending_exception = false; |
| 5323 Handle<Object> converted = | 5320 Handle<Object> converted = |
| 5324 Execution::ToString(isolate, key, &has_pending_exception); | 5321 Execution::ToString(isolate, key, &has_pending_exception); |
| 5325 if (has_pending_exception) return Handle<Object>(); // exception | 5322 if (has_pending_exception) return MaybeHandle<Object>(); // exception |
| 5326 Handle<String> name = Handle<String>::cast(converted); | 5323 Handle<String> name = Handle<String>::cast(converted); |
| 5327 | 5324 |
| 5328 if (name->AsArrayIndex(&index)) { | 5325 if (name->AsArrayIndex(&index)) { |
| 5329 return JSObject::SetElement(js_object, index, value, attr, strict_mode, | 5326 return JSObject::SetElement(js_object, index, value, attr, |
| 5330 true, | 5327 strict_mode, true, set_mode); |
| 5331 set_mode); | |
| 5332 } else { | 5328 } else { |
| 5333 return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode); | 5329 return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode); |
| 5334 } | 5330 } |
| 5335 } | 5331 } |
| 5336 | 5332 |
| 5337 | 5333 |
| 5338 MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object, | 5334 MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object, |
| 5339 Handle<Object> key, | 5335 Handle<Object> key, |
| 5340 Handle<Object> value, | 5336 Handle<Object> value, |
| 5341 PropertyAttributes attr) { | 5337 PropertyAttributes attr) { |
| 5342 Isolate* isolate = js_object->GetIsolate(); | 5338 Isolate* isolate = js_object->GetIsolate(); |
| 5343 // Check if the given key is an array index. | 5339 // Check if the given key is an array index. |
| 5344 uint32_t index; | 5340 uint32_t index; |
| 5345 if (key->ToArrayIndex(&index)) { | 5341 if (key->ToArrayIndex(&index)) { |
| 5346 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters | 5342 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters |
| 5347 // of a string using [] notation. We need to support this too in | 5343 // of a string using [] notation. We need to support this too in |
| 5348 // JavaScript. | 5344 // JavaScript. |
| 5349 // In the case of a String object we just need to redirect the assignment to | 5345 // In the case of a String object we just need to redirect the assignment to |
| 5350 // the underlying string if the index is in range. Since the underlying | 5346 // the underlying string if the index is in range. Since the underlying |
| 5351 // string does nothing with the assignment then we can ignore such | 5347 // string does nothing with the assignment then we can ignore such |
| 5352 // assignments. | 5348 // assignments. |
| 5353 if (js_object->IsStringObjectWithCharacterAt(index)) { | 5349 if (js_object->IsStringObjectWithCharacterAt(index)) { |
| 5354 return value; | 5350 return value; |
| 5355 } | 5351 } |
| 5356 | 5352 |
| 5357 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, | 5353 return JSObject::SetElement(js_object, index, value, attr, |
| 5358 false, | 5354 SLOPPY, false, DEFINE_PROPERTY); |
| 5359 DEFINE_PROPERTY); | |
| 5360 } | 5355 } |
| 5361 | 5356 |
| 5362 if (key->IsName()) { | 5357 if (key->IsName()) { |
| 5363 Handle<Name> name = Handle<Name>::cast(key); | 5358 Handle<Name> name = Handle<Name>::cast(key); |
| 5364 if (name->AsArrayIndex(&index)) { | 5359 if (name->AsArrayIndex(&index)) { |
| 5365 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, | 5360 return JSObject::SetElement(js_object, index, value, attr, |
| 5366 false, | 5361 SLOPPY, false, DEFINE_PROPERTY); |
| 5367 DEFINE_PROPERTY); | |
| 5368 } else { | 5362 } else { |
| 5369 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5363 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
| 5370 return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name, | 5364 return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name, |
| 5371 value, attr); | 5365 value, attr); |
| 5372 } | 5366 } |
| 5373 } | 5367 } |
| 5374 | 5368 |
| 5375 // Call-back into JavaScript to convert the key to a string. | 5369 // Call-back into JavaScript to convert the key to a string. |
| 5376 bool has_pending_exception = false; | 5370 bool has_pending_exception = false; |
| 5377 Handle<Object> converted = | 5371 Handle<Object> converted = |
| 5378 Execution::ToString(isolate, key, &has_pending_exception); | 5372 Execution::ToString(isolate, key, &has_pending_exception); |
| 5379 if (has_pending_exception) return Handle<Object>(); // exception | 5373 if (has_pending_exception) return MaybeHandle<Object>(); // exception |
| 5380 Handle<String> name = Handle<String>::cast(converted); | 5374 Handle<String> name = Handle<String>::cast(converted); |
| 5381 | 5375 |
| 5382 if (name->AsArrayIndex(&index)) { | 5376 if (name->AsArrayIndex(&index)) { |
| 5383 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, | 5377 return JSObject::SetElement(js_object, index, value, attr, |
| 5384 false, | 5378 SLOPPY, false, DEFINE_PROPERTY); |
| 5385 DEFINE_PROPERTY); | |
| 5386 } else { | 5379 } else { |
| 5387 return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name, value, | 5380 return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name, value, |
| 5388 attr); | 5381 attr); |
| 5389 } | 5382 } |
| 5390 } | 5383 } |
| 5391 | 5384 |
| 5392 | 5385 |
| 5393 MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate, | 5386 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, |
| 5394 Handle<JSReceiver> receiver, | 5387 Handle<JSReceiver> receiver, |
| 5395 Handle<Object> key, | 5388 Handle<Object> key, |
| 5396 JSReceiver::DeleteMode mode) { | 5389 JSReceiver::DeleteMode mode) { |
| 5397 HandleScope scope(isolate); | |
| 5398 | |
| 5399 // Check if the given key is an array index. | 5390 // Check if the given key is an array index. |
| 5400 uint32_t index; | 5391 uint32_t index; |
| 5401 if (key->ToArrayIndex(&index)) { | 5392 if (key->ToArrayIndex(&index)) { |
| 5402 // In Firefox/SpiderMonkey, Safari and Opera you can access the | 5393 // In Firefox/SpiderMonkey, Safari and Opera you can access the |
| 5403 // characters of a string using [] notation. In the case of a | 5394 // characters of a string using [] notation. In the case of a |
| 5404 // String object we just need to redirect the deletion to the | 5395 // String object we just need to redirect the deletion to the |
| 5405 // underlying string if the index is in range. Since the | 5396 // underlying string if the index is in range. Since the |
| 5406 // underlying string does nothing with the deletion, we can ignore | 5397 // underlying string does nothing with the deletion, we can ignore |
| 5407 // such deletions. | 5398 // such deletions. |
| 5408 if (receiver->IsStringObjectWithCharacterAt(index)) { | 5399 if (receiver->IsStringObjectWithCharacterAt(index)) { |
| 5409 return isolate->heap()->true_value(); | 5400 return isolate->factory()->true_value(); |
| 5410 } | 5401 } |
| 5411 | 5402 |
| 5412 Handle<Object> result = JSReceiver::DeleteElement(receiver, index, mode); | 5403 return JSReceiver::DeleteElement(receiver, index, mode); |
| 5413 RETURN_IF_EMPTY_HANDLE(isolate, result); | |
| 5414 return *result; | |
| 5415 } | 5404 } |
| 5416 | 5405 |
| 5417 Handle<Name> name; | 5406 Handle<Name> name; |
| 5418 if (key->IsName()) { | 5407 if (key->IsName()) { |
| 5419 name = Handle<Name>::cast(key); | 5408 name = Handle<Name>::cast(key); |
| 5420 } else { | 5409 } else { |
| 5421 // Call-back into JavaScript to convert the key to a string. | 5410 // Call-back into JavaScript to convert the key to a string. |
| 5422 bool has_pending_exception = false; | 5411 bool has_pending_exception = false; |
| 5423 Handle<Object> converted = Execution::ToString( | 5412 Handle<Object> converted = Execution::ToString( |
| 5424 isolate, key, &has_pending_exception); | 5413 isolate, key, &has_pending_exception); |
| 5425 if (has_pending_exception) return Failure::Exception(); | 5414 if (has_pending_exception) return MaybeHandle<Object>(); |
| 5426 name = Handle<String>::cast(converted); | 5415 name = Handle<String>::cast(converted); |
| 5427 } | 5416 } |
| 5428 | 5417 |
| 5429 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5418 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
| 5430 Handle<Object> result = JSReceiver::DeleteProperty(receiver, name, mode); | 5419 return JSReceiver::DeleteProperty(receiver, name, mode); |
| 5431 RETURN_IF_EMPTY_HANDLE(isolate, result); | |
| 5432 return *result; | |
| 5433 } | 5420 } |
| 5434 | 5421 |
| 5435 | 5422 |
| 5436 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHiddenProperty) { | 5423 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHiddenProperty) { |
| 5437 HandleScope scope(isolate); | 5424 HandleScope scope(isolate); |
| 5438 RUNTIME_ASSERT(args.length() == 3); | 5425 RUNTIME_ASSERT(args.length() == 3); |
| 5439 | 5426 |
| 5440 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 5427 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 5441 CONVERT_ARG_HANDLE_CHECKED(String, key, 1); | 5428 CONVERT_ARG_HANDLE_CHECKED(String, key, 1); |
| 5442 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 5429 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5637 | 5624 |
| 5638 | 5625 |
| 5639 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) { | 5626 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) { |
| 5640 HandleScope scope(isolate); | 5627 HandleScope scope(isolate); |
| 5641 ASSERT(args.length() == 3); | 5628 ASSERT(args.length() == 3); |
| 5642 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 5629 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 5643 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 5630 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 5644 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); | 5631 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); |
| 5645 JSReceiver::DeleteMode delete_mode = strict_mode == STRICT | 5632 JSReceiver::DeleteMode delete_mode = strict_mode == STRICT |
| 5646 ? JSReceiver::STRICT_DELETION : JSReceiver::NORMAL_DELETION; | 5633 ? JSReceiver::STRICT_DELETION : JSReceiver::NORMAL_DELETION; |
| 5647 Handle<Object> result = JSReceiver::DeleteProperty(object, key, delete_mode); | 5634 Handle<Object> result; |
| 5648 RETURN_IF_EMPTY_HANDLE(isolate, result); | 5635 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 5636 isolate, result, |
| 5637 JSReceiver::DeleteProperty(object, key, delete_mode)); |
| 5649 return *result; | 5638 return *result; |
| 5650 } | 5639 } |
| 5651 | 5640 |
| 5652 | 5641 |
| 5653 static MaybeObject* HasLocalPropertyImplementation(Isolate* isolate, | 5642 static MaybeObject* HasLocalPropertyImplementation(Isolate* isolate, |
| 5654 Handle<JSObject> object, | 5643 Handle<JSObject> object, |
| 5655 Handle<Name> key) { | 5644 Handle<Name> key) { |
| 5656 if (JSReceiver::HasLocalProperty(object, key)) { | 5645 if (JSReceiver::HasLocalProperty(object, key)) { |
| 5657 return isolate->heap()->true_value(); | 5646 return isolate->heap()->true_value(); |
| 5658 } | 5647 } |
| (...skipping 3552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9211 | 9200 |
| 9212 // If the slot was found in a context, it should be DONT_DELETE. | 9201 // If the slot was found in a context, it should be DONT_DELETE. |
| 9213 if (holder->IsContext()) { | 9202 if (holder->IsContext()) { |
| 9214 return isolate->heap()->false_value(); | 9203 return isolate->heap()->false_value(); |
| 9215 } | 9204 } |
| 9216 | 9205 |
| 9217 // The slot was found in a JSObject, either a context extension object, | 9206 // The slot was found in a JSObject, either a context extension object, |
| 9218 // the global object, or the subject of a with. Try to delete it | 9207 // the global object, or the subject of a with. Try to delete it |
| 9219 // (respecting DONT_DELETE). | 9208 // (respecting DONT_DELETE). |
| 9220 Handle<JSObject> object = Handle<JSObject>::cast(holder); | 9209 Handle<JSObject> object = Handle<JSObject>::cast(holder); |
| 9221 Handle<Object> result = JSReceiver::DeleteProperty(object, name); | 9210 Handle<Object> result; |
| 9222 RETURN_IF_EMPTY_HANDLE(isolate, result); | 9211 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 9212 isolate, result, |
| 9213 JSReceiver::DeleteProperty(object, name)); |
| 9223 return *result; | 9214 return *result; |
| 9224 } | 9215 } |
| 9225 | 9216 |
| 9226 | 9217 |
| 9227 // A mechanism to return a pair of Object pointers in registers (if possible). | 9218 // A mechanism to return a pair of Object pointers in registers (if possible). |
| 9228 // How this is achieved is calling convention-dependent. | 9219 // How this is achieved is calling convention-dependent. |
| 9229 // All currently supported x86 compiles uses calling conventions that are cdecl | 9220 // All currently supported x86 compiles uses calling conventions that are cdecl |
| 9230 // variants where a 64-bit value is returned in two 32-bit registers | 9221 // variants where a 64-bit value is returned in two 32-bit registers |
| 9231 // (edx:eax on ia32, r1:r0 on ARM). | 9222 // (edx:eax on ia32, r1:r0 on ARM). |
| 9232 // In AMD-64 calling convention a struct of two pointers is returned in rdx:rax. | 9223 // In AMD-64 calling convention a struct of two pointers is returned in rdx:rax. |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9927 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 9918 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
| 9928 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, element, 1); | 9919 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, element, 1); |
| 9929 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); | 9920 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); |
| 9930 int length = Smi::cast(array->length())->value(); | 9921 int length = Smi::cast(array->length())->value(); |
| 9931 FixedArray* elements = FixedArray::cast(array->elements()); | 9922 FixedArray* elements = FixedArray::cast(array->elements()); |
| 9932 for (int i = 0; i < length; i++) { | 9923 for (int i = 0; i < length; i++) { |
| 9933 if (elements->get(i) == *element) return isolate->heap()->false_value(); | 9924 if (elements->get(i) == *element) return isolate->heap()->false_value(); |
| 9934 } | 9925 } |
| 9935 | 9926 |
| 9936 // Strict not needed. Used for cycle detection in Array join implementation. | 9927 // Strict not needed. Used for cycle detection in Array join implementation. |
| 9937 RETURN_IF_EMPTY_HANDLE(isolate, JSObject::SetFastElement(array, length, | 9928 RETURN_FAILURE_ON_EXCEPTION( |
| 9938 element, | 9929 isolate, |
| 9939 SLOPPY, | 9930 JSObject::SetFastElement(array, length, element, SLOPPY, true)); |
| 9940 true)); | |
| 9941 return isolate->heap()->true_value(); | 9931 return isolate->heap()->true_value(); |
| 9942 } | 9932 } |
| 9943 | 9933 |
| 9944 | 9934 |
| 9945 /** | 9935 /** |
| 9946 * A simple visitor visits every element of Array's. | 9936 * A simple visitor visits every element of Array's. |
| 9947 * The backend storage can be a fixed array for fast elements case, | 9937 * The backend storage can be a fixed array for fast elements case, |
| 9948 * or a dictionary for sparse array. Since Dictionary is a subtype | 9938 * or a dictionary for sparse array. Since Dictionary is a subtype |
| 9949 * of FixedArray, the class can be used by both fast and slow cases. | 9939 * of FixedArray, the class can be used by both fast and slow cases. |
| 9950 * The second parameter of the constructor, fast_elements, specifies | 9940 * The second parameter of the constructor, fast_elements, specifies |
| (...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12286 } else { | 12276 } else { |
| 12287 JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id); | 12277 JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id); |
| 12288 // If our frame is a top frame and we are stepping, we can do step-in | 12278 // If our frame is a top frame and we are stepping, we can do step-in |
| 12289 // at this place. | 12279 // at this place. |
| 12290 accept = additional_frame_it.frame()->id() == id; | 12280 accept = additional_frame_it.frame()->id() == id; |
| 12291 } | 12281 } |
| 12292 } | 12282 } |
| 12293 if (accept) { | 12283 if (accept) { |
| 12294 if (break_location_iterator.IsStepInLocation(isolate)) { | 12284 if (break_location_iterator.IsStepInLocation(isolate)) { |
| 12295 Smi* position_value = Smi::FromInt(break_location_iterator.position()); | 12285 Smi* position_value = Smi::FromInt(break_location_iterator.position()); |
| 12296 JSObject::SetElement(array, len, | 12286 RETURN_FAILURE_ON_EXCEPTION( |
| 12297 Handle<Object>(position_value, isolate), | 12287 isolate, |
| 12298 NONE, SLOPPY); | 12288 JSObject::SetElement(array, len, |
| 12289 Handle<Object>(position_value, isolate), |
| 12290 NONE, SLOPPY)); |
| 12299 len++; | 12291 len++; |
| 12300 } | 12292 } |
| 12301 } | 12293 } |
| 12302 // Advance iterator. | 12294 // Advance iterator. |
| 12303 break_location_iterator.Next(); | 12295 break_location_iterator.Next(); |
| 12304 if (current_statement_pos != | 12296 if (current_statement_pos != |
| 12305 break_location_iterator.statement_position()) { | 12297 break_location_iterator.statement_position()) { |
| 12306 break; | 12298 break; |
| 12307 } | 12299 } |
| 12308 } | 12300 } |
| (...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15237 } | 15229 } |
| 15238 } | 15230 } |
| 15239 | 15231 |
| 15240 | 15232 |
| 15241 void Runtime::OutOfMemory() { | 15233 void Runtime::OutOfMemory() { |
| 15242 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15234 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
| 15243 UNREACHABLE(); | 15235 UNREACHABLE(); |
| 15244 } | 15236 } |
| 15245 | 15237 |
| 15246 } } // namespace v8::internal | 15238 } } // namespace v8::internal |
| OLD | NEW |