OLD | NEW |
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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 MaybeHandle<Object> JSProxy::GetPropertyWithHandler(Handle<JSProxy> proxy, | 402 MaybeHandle<Object> JSProxy::GetPropertyWithHandler(Handle<JSProxy> proxy, |
403 Handle<Object> receiver, | 403 Handle<Object> receiver, |
404 Handle<Name> name) { | 404 Handle<Name> name) { |
405 Isolate* isolate = proxy->GetIsolate(); | 405 Isolate* isolate = proxy->GetIsolate(); |
406 | 406 |
407 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 407 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
408 if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 408 if (name->IsSymbol()) return isolate->factory()->undefined_value(); |
409 | 409 |
410 Handle<Object> args[] = { receiver, name }; | 410 Handle<Object> args[] = { receiver, name }; |
411 return CallTrap( | 411 return CallTrap( |
412 proxy, "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); | 412 proxy, "get", isolate->derived_get_trap(), arraysize(args), args); |
413 } | 413 } |
414 | 414 |
415 | 415 |
416 MaybeHandle<Object> Object::GetPropertyWithAccessor(Handle<Object> receiver, | 416 MaybeHandle<Object> Object::GetPropertyWithAccessor(Handle<Object> receiver, |
417 Handle<Name> name, | 417 Handle<Name> name, |
418 Handle<JSObject> holder, | 418 Handle<JSObject> holder, |
419 Handle<Object> structure) { | 419 Handle<Object> structure) { |
420 Isolate* isolate = name->GetIsolate(); | 420 Isolate* isolate = name->GetIsolate(); |
421 DCHECK(!structure->IsForeign()); | 421 DCHECK(!structure->IsForeign()); |
422 // api style callbacks. | 422 // api style callbacks. |
423 if (structure->IsAccessorInfo()) { | 423 if (structure->IsAccessorInfo()) { |
424 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); | 424 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); |
425 if (!info->IsCompatibleReceiver(*receiver)) { | 425 if (!info->IsCompatibleReceiver(*receiver)) { |
426 Handle<Object> args[2] = { name, receiver }; | 426 Handle<Object> args[2] = { name, receiver }; |
427 Handle<Object> error = | 427 Handle<Object> error = |
428 isolate->factory()->NewTypeError("incompatible_method_receiver", | 428 isolate->factory()->NewTypeError("incompatible_method_receiver", |
429 HandleVector(args, | 429 HandleVector(args, |
430 ARRAY_SIZE(args))); | 430 arraysize(args))); |
431 return isolate->Throw<Object>(error); | 431 return isolate->Throw<Object>(error); |
432 } | 432 } |
433 if (structure->IsDeclaredAccessorInfo()) { | 433 if (structure->IsDeclaredAccessorInfo()) { |
434 return GetDeclaredAccessorProperty( | 434 return GetDeclaredAccessorProperty( |
435 receiver, | 435 receiver, |
436 Handle<DeclaredAccessorInfo>::cast(structure), | 436 Handle<DeclaredAccessorInfo>::cast(structure), |
437 isolate); | 437 isolate); |
438 } | 438 } |
439 | 439 |
440 Handle<ExecutableAccessorInfo> data = | 440 Handle<ExecutableAccessorInfo> data = |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 if (structure->IsExecutableAccessorInfo()) { | 492 if (structure->IsExecutableAccessorInfo()) { |
493 // Don't call executable accessor setters with non-JSObject receivers. | 493 // Don't call executable accessor setters with non-JSObject receivers. |
494 if (!receiver->IsJSObject()) return value; | 494 if (!receiver->IsJSObject()) return value; |
495 // api style callbacks | 495 // api style callbacks |
496 ExecutableAccessorInfo* info = ExecutableAccessorInfo::cast(*structure); | 496 ExecutableAccessorInfo* info = ExecutableAccessorInfo::cast(*structure); |
497 if (!info->IsCompatibleReceiver(*receiver)) { | 497 if (!info->IsCompatibleReceiver(*receiver)) { |
498 Handle<Object> args[2] = { name, receiver }; | 498 Handle<Object> args[2] = { name, receiver }; |
499 Handle<Object> error = | 499 Handle<Object> error = |
500 isolate->factory()->NewTypeError("incompatible_method_receiver", | 500 isolate->factory()->NewTypeError("incompatible_method_receiver", |
501 HandleVector(args, | 501 HandleVector(args, |
502 ARRAY_SIZE(args))); | 502 arraysize(args))); |
503 return isolate->Throw<Object>(error); | 503 return isolate->Throw<Object>(error); |
504 } | 504 } |
505 Object* call_obj = info->setter(); | 505 Object* call_obj = info->setter(); |
506 v8::AccessorNameSetterCallback call_fun = | 506 v8::AccessorNameSetterCallback call_fun = |
507 v8::ToCData<v8::AccessorNameSetterCallback>(call_obj); | 507 v8::ToCData<v8::AccessorNameSetterCallback>(call_obj); |
508 if (call_fun == NULL) return value; | 508 if (call_fun == NULL) return value; |
509 LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name)); | 509 LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name)); |
510 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder); | 510 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder); |
511 args.Call(call_fun, | 511 args.Call(call_fun, |
512 v8::Utils::ToLocal(name), | 512 v8::Utils::ToLocal(name), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 Debug* debug = isolate->debug(); | 566 Debug* debug = isolate->debug(); |
567 // Handle stepping into a setter if step into is active. | 567 // Handle stepping into a setter if step into is active. |
568 // TODO(rossberg): should this apply to getters that are function proxies? | 568 // TODO(rossberg): should this apply to getters that are function proxies? |
569 if (debug->StepInActive() && setter->IsJSFunction()) { | 569 if (debug->StepInActive() && setter->IsJSFunction()) { |
570 debug->HandleStepIn( | 570 debug->HandleStepIn( |
571 Handle<JSFunction>::cast(setter), Handle<Object>::null(), 0, false); | 571 Handle<JSFunction>::cast(setter), Handle<Object>::null(), 0, false); |
572 } | 572 } |
573 | 573 |
574 Handle<Object> argv[] = { value }; | 574 Handle<Object> argv[] = { value }; |
575 RETURN_ON_EXCEPTION(isolate, Execution::Call(isolate, setter, receiver, | 575 RETURN_ON_EXCEPTION(isolate, Execution::Call(isolate, setter, receiver, |
576 ARRAY_SIZE(argv), argv, true), | 576 arraysize(argv), argv, true), |
577 Object); | 577 Object); |
578 return value; | 578 return value; |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 static bool FindAllCanReadHolder(LookupIterator* it) { | 582 static bool FindAllCanReadHolder(LookupIterator* it) { |
583 for (; it->IsFound(); it->Next()) { | 583 for (; it->IsFound(); it->Next()) { |
584 if (it->state() == LookupIterator::PROPERTY && | 584 if (it->state() == LookupIterator::PROPERTY && |
585 it->HasProperty() && | 585 it->HasProperty() && |
586 it->property_kind() == LookupIterator::ACCESSOR) { | 586 it->property_kind() == LookupIterator::ACCESSOR) { |
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 } | 2920 } |
2921 | 2921 |
2922 | 2922 |
2923 MaybeHandle<Object> Object::WriteToReadOnlyProperty(LookupIterator* it, | 2923 MaybeHandle<Object> Object::WriteToReadOnlyProperty(LookupIterator* it, |
2924 Handle<Object> value, | 2924 Handle<Object> value, |
2925 StrictMode strict_mode) { | 2925 StrictMode strict_mode) { |
2926 if (strict_mode != STRICT) return value; | 2926 if (strict_mode != STRICT) return value; |
2927 | 2927 |
2928 Handle<Object> args[] = {it->name(), it->GetReceiver()}; | 2928 Handle<Object> args[] = {it->name(), it->GetReceiver()}; |
2929 Handle<Object> error = it->factory()->NewTypeError( | 2929 Handle<Object> error = it->factory()->NewTypeError( |
2930 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); | 2930 "strict_read_only_property", HandleVector(args, arraysize(args))); |
2931 return it->isolate()->Throw<Object>(error); | 2931 return it->isolate()->Throw<Object>(error); |
2932 } | 2932 } |
2933 | 2933 |
2934 | 2934 |
2935 Handle<Object> Object::SetDataProperty(LookupIterator* it, | 2935 Handle<Object> Object::SetDataProperty(LookupIterator* it, |
2936 Handle<Object> value) { | 2936 Handle<Object> value) { |
2937 // Proxies are handled on the WithHandler path. Other non-JSObjects cannot | 2937 // Proxies are handled on the WithHandler path. Other non-JSObjects cannot |
2938 // have own properties. | 2938 // have own properties. |
2939 Handle<JSObject> receiver = Handle<JSObject>::cast(it->GetReceiver()); | 2939 Handle<JSObject> receiver = Handle<JSObject>::cast(it->GetReceiver()); |
2940 | 2940 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 if (receiver->IsJSGlobalProxy()) return value; | 2985 if (receiver->IsJSGlobalProxy()) return value; |
2986 | 2986 |
2987 // Possibly migrate to the most up-to-date map that will be able to store | 2987 // Possibly migrate to the most up-to-date map that will be able to store |
2988 // |value| under it->name() with |attributes|. | 2988 // |value| under it->name() with |attributes|. |
2989 it->PrepareTransitionToDataProperty(value, attributes, store_mode); | 2989 it->PrepareTransitionToDataProperty(value, attributes, store_mode); |
2990 if (it->state() != LookupIterator::TRANSITION) { | 2990 if (it->state() != LookupIterator::TRANSITION) { |
2991 if (strict_mode == SLOPPY) return value; | 2991 if (strict_mode == SLOPPY) return value; |
2992 | 2992 |
2993 Handle<Object> args[1] = {it->name()}; | 2993 Handle<Object> args[1] = {it->name()}; |
2994 Handle<Object> error = it->factory()->NewTypeError( | 2994 Handle<Object> error = it->factory()->NewTypeError( |
2995 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); | 2995 "object_not_extensible", HandleVector(args, arraysize(args))); |
2996 return it->isolate()->Throw<Object>(error); | 2996 return it->isolate()->Throw<Object>(error); |
2997 } | 2997 } |
2998 it->ApplyTransitionToDataProperty(); | 2998 it->ApplyTransitionToDataProperty(); |
2999 | 2999 |
3000 // TODO(verwaest): Encapsulate dictionary handling better. | 3000 // TODO(verwaest): Encapsulate dictionary handling better. |
3001 if (receiver->map()->is_dictionary_map()) { | 3001 if (receiver->map()->is_dictionary_map()) { |
3002 // TODO(verwaest): Probably should ensure this is done beforehand. | 3002 // TODO(verwaest): Probably should ensure this is done beforehand. |
3003 it->InternalizeName(); | 3003 it->InternalizeName(); |
3004 JSObject::AddSlowProperty(receiver, it->name(), value, attributes); | 3004 JSObject::AddSlowProperty(receiver, it->name(), value, attributes); |
3005 } else { | 3005 } else { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3394 Handle<Name> name) { | 3394 Handle<Name> name) { |
3395 Isolate* isolate = proxy->GetIsolate(); | 3395 Isolate* isolate = proxy->GetIsolate(); |
3396 | 3396 |
3397 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 3397 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
3398 if (name->IsSymbol()) return maybe(false); | 3398 if (name->IsSymbol()) return maybe(false); |
3399 | 3399 |
3400 Handle<Object> args[] = { name }; | 3400 Handle<Object> args[] = { name }; |
3401 Handle<Object> result; | 3401 Handle<Object> result; |
3402 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 3402 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
3403 isolate, result, CallTrap(proxy, "has", isolate->derived_has_trap(), | 3403 isolate, result, CallTrap(proxy, "has", isolate->derived_has_trap(), |
3404 ARRAY_SIZE(args), args), | 3404 arraysize(args), args), |
3405 Maybe<bool>()); | 3405 Maybe<bool>()); |
3406 | 3406 |
3407 return maybe(result->BooleanValue()); | 3407 return maybe(result->BooleanValue()); |
3408 } | 3408 } |
3409 | 3409 |
3410 | 3410 |
3411 MaybeHandle<Object> JSProxy::SetPropertyWithHandler(Handle<JSProxy> proxy, | 3411 MaybeHandle<Object> JSProxy::SetPropertyWithHandler(Handle<JSProxy> proxy, |
3412 Handle<Object> receiver, | 3412 Handle<Object> receiver, |
3413 Handle<Name> name, | 3413 Handle<Name> name, |
3414 Handle<Object> value, | 3414 Handle<Object> value, |
3415 StrictMode strict_mode) { | 3415 StrictMode strict_mode) { |
3416 Isolate* isolate = proxy->GetIsolate(); | 3416 Isolate* isolate = proxy->GetIsolate(); |
3417 | 3417 |
3418 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 3418 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
3419 if (name->IsSymbol()) return value; | 3419 if (name->IsSymbol()) return value; |
3420 | 3420 |
3421 Handle<Object> args[] = { receiver, name, value }; | 3421 Handle<Object> args[] = { receiver, name, value }; |
3422 RETURN_ON_EXCEPTION( | 3422 RETURN_ON_EXCEPTION( |
3423 isolate, | 3423 isolate, |
3424 CallTrap(proxy, | 3424 CallTrap(proxy, |
3425 "set", | 3425 "set", |
3426 isolate->derived_set_trap(), | 3426 isolate->derived_set_trap(), |
3427 ARRAY_SIZE(args), | 3427 arraysize(args), |
3428 args), | 3428 args), |
3429 Object); | 3429 Object); |
3430 | 3430 |
3431 return value; | 3431 return value; |
3432 } | 3432 } |
3433 | 3433 |
3434 | 3434 |
3435 MaybeHandle<Object> JSProxy::SetPropertyViaPrototypesWithHandler( | 3435 MaybeHandle<Object> JSProxy::SetPropertyViaPrototypesWithHandler( |
3436 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, | 3436 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
3437 Handle<Object> value, StrictMode strict_mode, bool* done) { | 3437 Handle<Object> value, StrictMode strict_mode, bool* done) { |
3438 Isolate* isolate = proxy->GetIsolate(); | 3438 Isolate* isolate = proxy->GetIsolate(); |
3439 Handle<Object> handler(proxy->handler(), isolate); // Trap might morph proxy. | 3439 Handle<Object> handler(proxy->handler(), isolate); // Trap might morph proxy. |
3440 | 3440 |
3441 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 3441 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
3442 if (name->IsSymbol()) { | 3442 if (name->IsSymbol()) { |
3443 *done = false; | 3443 *done = false; |
3444 return isolate->factory()->the_hole_value(); | 3444 return isolate->factory()->the_hole_value(); |
3445 } | 3445 } |
3446 | 3446 |
3447 *done = true; // except where redefined... | 3447 *done = true; // except where redefined... |
3448 Handle<Object> args[] = { name }; | 3448 Handle<Object> args[] = { name }; |
3449 Handle<Object> result; | 3449 Handle<Object> result; |
3450 ASSIGN_RETURN_ON_EXCEPTION( | 3450 ASSIGN_RETURN_ON_EXCEPTION( |
3451 isolate, result, | 3451 isolate, result, |
3452 CallTrap(proxy, | 3452 CallTrap(proxy, |
3453 "getPropertyDescriptor", | 3453 "getPropertyDescriptor", |
3454 Handle<Object>(), | 3454 Handle<Object>(), |
3455 ARRAY_SIZE(args), | 3455 arraysize(args), |
3456 args), | 3456 args), |
3457 Object); | 3457 Object); |
3458 | 3458 |
3459 if (result->IsUndefined()) { | 3459 if (result->IsUndefined()) { |
3460 *done = false; | 3460 *done = false; |
3461 return isolate->factory()->the_hole_value(); | 3461 return isolate->factory()->the_hole_value(); |
3462 } | 3462 } |
3463 | 3463 |
3464 // Emulate [[GetProperty]] semantics for proxies. | 3464 // Emulate [[GetProperty]] semantics for proxies. |
3465 Handle<Object> argv[] = { result }; | 3465 Handle<Object> argv[] = { result }; |
3466 Handle<Object> desc; | 3466 Handle<Object> desc; |
3467 ASSIGN_RETURN_ON_EXCEPTION( | 3467 ASSIGN_RETURN_ON_EXCEPTION( |
3468 isolate, desc, | 3468 isolate, desc, |
3469 Execution::Call(isolate, | 3469 Execution::Call(isolate, |
3470 isolate->to_complete_property_descriptor(), | 3470 isolate->to_complete_property_descriptor(), |
3471 result, | 3471 result, |
3472 ARRAY_SIZE(argv), | 3472 arraysize(argv), |
3473 argv), | 3473 argv), |
3474 Object); | 3474 Object); |
3475 | 3475 |
3476 // [[GetProperty]] requires to check that all properties are configurable. | 3476 // [[GetProperty]] requires to check that all properties are configurable. |
3477 Handle<String> configurable_name = | 3477 Handle<String> configurable_name = |
3478 isolate->factory()->InternalizeOneByteString( | 3478 isolate->factory()->InternalizeOneByteString( |
3479 STATIC_ASCII_VECTOR("configurable_")); | 3479 STATIC_ASCII_VECTOR("configurable_")); |
3480 Handle<Object> configurable = | 3480 Handle<Object> configurable = |
3481 Object::GetProperty(desc, configurable_name).ToHandleChecked(); | 3481 Object::GetProperty(desc, configurable_name).ToHandleChecked(); |
3482 DCHECK(configurable->IsBoolean()); | 3482 DCHECK(configurable->IsBoolean()); |
3483 if (configurable->IsFalse()) { | 3483 if (configurable->IsFalse()) { |
3484 Handle<String> trap = | 3484 Handle<String> trap = |
3485 isolate->factory()->InternalizeOneByteString( | 3485 isolate->factory()->InternalizeOneByteString( |
3486 STATIC_ASCII_VECTOR("getPropertyDescriptor")); | 3486 STATIC_ASCII_VECTOR("getPropertyDescriptor")); |
3487 Handle<Object> args[] = { handler, trap, name }; | 3487 Handle<Object> args[] = { handler, trap, name }; |
3488 Handle<Object> error = isolate->factory()->NewTypeError( | 3488 Handle<Object> error = isolate->factory()->NewTypeError( |
3489 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); | 3489 "proxy_prop_not_configurable", HandleVector(args, arraysize(args))); |
3490 return isolate->Throw<Object>(error); | 3490 return isolate->Throw<Object>(error); |
3491 } | 3491 } |
3492 DCHECK(configurable->IsTrue()); | 3492 DCHECK(configurable->IsTrue()); |
3493 | 3493 |
3494 // Check for DataDescriptor. | 3494 // Check for DataDescriptor. |
3495 Handle<String> hasWritable_name = | 3495 Handle<String> hasWritable_name = |
3496 isolate->factory()->InternalizeOneByteString( | 3496 isolate->factory()->InternalizeOneByteString( |
3497 STATIC_ASCII_VECTOR("hasWritable_")); | 3497 STATIC_ASCII_VECTOR("hasWritable_")); |
3498 Handle<Object> hasWritable = | 3498 Handle<Object> hasWritable = |
3499 Object::GetProperty(desc, hasWritable_name).ToHandleChecked(); | 3499 Object::GetProperty(desc, hasWritable_name).ToHandleChecked(); |
3500 DCHECK(hasWritable->IsBoolean()); | 3500 DCHECK(hasWritable->IsBoolean()); |
3501 if (hasWritable->IsTrue()) { | 3501 if (hasWritable->IsTrue()) { |
3502 Handle<String> writable_name = | 3502 Handle<String> writable_name = |
3503 isolate->factory()->InternalizeOneByteString( | 3503 isolate->factory()->InternalizeOneByteString( |
3504 STATIC_ASCII_VECTOR("writable_")); | 3504 STATIC_ASCII_VECTOR("writable_")); |
3505 Handle<Object> writable = | 3505 Handle<Object> writable = |
3506 Object::GetProperty(desc, writable_name).ToHandleChecked(); | 3506 Object::GetProperty(desc, writable_name).ToHandleChecked(); |
3507 DCHECK(writable->IsBoolean()); | 3507 DCHECK(writable->IsBoolean()); |
3508 *done = writable->IsFalse(); | 3508 *done = writable->IsFalse(); |
3509 if (!*done) return isolate->factory()->the_hole_value(); | 3509 if (!*done) return isolate->factory()->the_hole_value(); |
3510 if (strict_mode == SLOPPY) return value; | 3510 if (strict_mode == SLOPPY) return value; |
3511 Handle<Object> args[] = { name, receiver }; | 3511 Handle<Object> args[] = { name, receiver }; |
3512 Handle<Object> error = isolate->factory()->NewTypeError( | 3512 Handle<Object> error = isolate->factory()->NewTypeError( |
3513 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); | 3513 "strict_read_only_property", HandleVector(args, arraysize(args))); |
3514 return isolate->Throw<Object>(error); | 3514 return isolate->Throw<Object>(error); |
3515 } | 3515 } |
3516 | 3516 |
3517 // We have an AccessorDescriptor. | 3517 // We have an AccessorDescriptor. |
3518 Handle<String> set_name = isolate->factory()->InternalizeOneByteString( | 3518 Handle<String> set_name = isolate->factory()->InternalizeOneByteString( |
3519 STATIC_ASCII_VECTOR("set_")); | 3519 STATIC_ASCII_VECTOR("set_")); |
3520 Handle<Object> setter = Object::GetProperty(desc, set_name).ToHandleChecked(); | 3520 Handle<Object> setter = Object::GetProperty(desc, set_name).ToHandleChecked(); |
3521 if (!setter->IsUndefined()) { | 3521 if (!setter->IsUndefined()) { |
3522 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 3522 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
3523 return SetPropertyWithDefinedSetter( | 3523 return SetPropertyWithDefinedSetter( |
3524 receiver, Handle<JSReceiver>::cast(setter), value); | 3524 receiver, Handle<JSReceiver>::cast(setter), value); |
3525 } | 3525 } |
3526 | 3526 |
3527 if (strict_mode == SLOPPY) return value; | 3527 if (strict_mode == SLOPPY) return value; |
3528 Handle<Object> args2[] = { name, proxy }; | 3528 Handle<Object> args2[] = { name, proxy }; |
3529 Handle<Object> error = isolate->factory()->NewTypeError( | 3529 Handle<Object> error = isolate->factory()->NewTypeError( |
3530 "no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2))); | 3530 "no_setter_in_callback", HandleVector(args2, arraysize(args2))); |
3531 return isolate->Throw<Object>(error); | 3531 return isolate->Throw<Object>(error); |
3532 } | 3532 } |
3533 | 3533 |
3534 | 3534 |
3535 MaybeHandle<Object> JSProxy::DeletePropertyWithHandler( | 3535 MaybeHandle<Object> JSProxy::DeletePropertyWithHandler( |
3536 Handle<JSProxy> proxy, Handle<Name> name, DeleteMode mode) { | 3536 Handle<JSProxy> proxy, Handle<Name> name, DeleteMode mode) { |
3537 Isolate* isolate = proxy->GetIsolate(); | 3537 Isolate* isolate = proxy->GetIsolate(); |
3538 | 3538 |
3539 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 3539 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
3540 if (name->IsSymbol()) return isolate->factory()->false_value(); | 3540 if (name->IsSymbol()) return isolate->factory()->false_value(); |
3541 | 3541 |
3542 Handle<Object> args[] = { name }; | 3542 Handle<Object> args[] = { name }; |
3543 Handle<Object> result; | 3543 Handle<Object> result; |
3544 ASSIGN_RETURN_ON_EXCEPTION( | 3544 ASSIGN_RETURN_ON_EXCEPTION( |
3545 isolate, result, | 3545 isolate, result, |
3546 CallTrap(proxy, | 3546 CallTrap(proxy, |
3547 "delete", | 3547 "delete", |
3548 Handle<Object>(), | 3548 Handle<Object>(), |
3549 ARRAY_SIZE(args), | 3549 arraysize(args), |
3550 args), | 3550 args), |
3551 Object); | 3551 Object); |
3552 | 3552 |
3553 bool result_bool = result->BooleanValue(); | 3553 bool result_bool = result->BooleanValue(); |
3554 if (mode == STRICT_DELETION && !result_bool) { | 3554 if (mode == STRICT_DELETION && !result_bool) { |
3555 Handle<Object> handler(proxy->handler(), isolate); | 3555 Handle<Object> handler(proxy->handler(), isolate); |
3556 Handle<String> trap_name = isolate->factory()->InternalizeOneByteString( | 3556 Handle<String> trap_name = isolate->factory()->InternalizeOneByteString( |
3557 STATIC_ASCII_VECTOR("delete")); | 3557 STATIC_ASCII_VECTOR("delete")); |
3558 Handle<Object> args[] = { handler, trap_name }; | 3558 Handle<Object> args[] = { handler, trap_name }; |
3559 Handle<Object> error = isolate->factory()->NewTypeError( | 3559 Handle<Object> error = isolate->factory()->NewTypeError( |
3560 "handler_failed", HandleVector(args, ARRAY_SIZE(args))); | 3560 "handler_failed", HandleVector(args, arraysize(args))); |
3561 return isolate->Throw<Object>(error); | 3561 return isolate->Throw<Object>(error); |
3562 } | 3562 } |
3563 return isolate->factory()->ToBoolean(result_bool); | 3563 return isolate->factory()->ToBoolean(result_bool); |
3564 } | 3564 } |
3565 | 3565 |
3566 | 3566 |
3567 MaybeHandle<Object> JSProxy::DeleteElementWithHandler( | 3567 MaybeHandle<Object> JSProxy::DeleteElementWithHandler( |
3568 Handle<JSProxy> proxy, uint32_t index, DeleteMode mode) { | 3568 Handle<JSProxy> proxy, uint32_t index, DeleteMode mode) { |
3569 Isolate* isolate = proxy->GetIsolate(); | 3569 Isolate* isolate = proxy->GetIsolate(); |
3570 Handle<String> name = isolate->factory()->Uint32ToString(index); | 3570 Handle<String> name = isolate->factory()->Uint32ToString(index); |
3571 return JSProxy::DeletePropertyWithHandler(proxy, name, mode); | 3571 return JSProxy::DeletePropertyWithHandler(proxy, name, mode); |
3572 } | 3572 } |
3573 | 3573 |
3574 | 3574 |
3575 Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler( | 3575 Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler( |
3576 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name) { | 3576 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name) { |
3577 Isolate* isolate = proxy->GetIsolate(); | 3577 Isolate* isolate = proxy->GetIsolate(); |
3578 HandleScope scope(isolate); | 3578 HandleScope scope(isolate); |
3579 | 3579 |
3580 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 3580 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
3581 if (name->IsSymbol()) return maybe(ABSENT); | 3581 if (name->IsSymbol()) return maybe(ABSENT); |
3582 | 3582 |
3583 Handle<Object> args[] = { name }; | 3583 Handle<Object> args[] = { name }; |
3584 Handle<Object> result; | 3584 Handle<Object> result; |
3585 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 3585 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
3586 isolate, result, | 3586 isolate, result, |
3587 proxy->CallTrap(proxy, "getPropertyDescriptor", Handle<Object>(), | 3587 proxy->CallTrap(proxy, "getPropertyDescriptor", Handle<Object>(), |
3588 ARRAY_SIZE(args), args), | 3588 arraysize(args), args), |
3589 Maybe<PropertyAttributes>()); | 3589 Maybe<PropertyAttributes>()); |
3590 | 3590 |
3591 if (result->IsUndefined()) return maybe(ABSENT); | 3591 if (result->IsUndefined()) return maybe(ABSENT); |
3592 | 3592 |
3593 Handle<Object> argv[] = { result }; | 3593 Handle<Object> argv[] = { result }; |
3594 Handle<Object> desc; | 3594 Handle<Object> desc; |
3595 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 3595 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
3596 isolate, desc, | 3596 isolate, desc, |
3597 Execution::Call(isolate, isolate->to_complete_property_descriptor(), | 3597 Execution::Call(isolate, isolate->to_complete_property_descriptor(), |
3598 result, ARRAY_SIZE(argv), argv), | 3598 result, arraysize(argv), argv), |
3599 Maybe<PropertyAttributes>()); | 3599 Maybe<PropertyAttributes>()); |
3600 | 3600 |
3601 // Convert result to PropertyAttributes. | 3601 // Convert result to PropertyAttributes. |
3602 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( | 3602 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( |
3603 STATIC_ASCII_VECTOR("enumerable_")); | 3603 STATIC_ASCII_VECTOR("enumerable_")); |
3604 Handle<Object> enumerable; | 3604 Handle<Object> enumerable; |
3605 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, enumerable, | 3605 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, enumerable, |
3606 Object::GetProperty(desc, enum_n), | 3606 Object::GetProperty(desc, enum_n), |
3607 Maybe<PropertyAttributes>()); | 3607 Maybe<PropertyAttributes>()); |
3608 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( | 3608 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( |
(...skipping 17 matching lines...) Expand all Loading... |
3626 Maybe<PropertyAttributes>()); | 3626 Maybe<PropertyAttributes>()); |
3627 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); | 3627 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); |
3628 } | 3628 } |
3629 | 3629 |
3630 if (configurable->IsFalse()) { | 3630 if (configurable->IsFalse()) { |
3631 Handle<Object> handler(proxy->handler(), isolate); | 3631 Handle<Object> handler(proxy->handler(), isolate); |
3632 Handle<String> trap = isolate->factory()->InternalizeOneByteString( | 3632 Handle<String> trap = isolate->factory()->InternalizeOneByteString( |
3633 STATIC_ASCII_VECTOR("getPropertyDescriptor")); | 3633 STATIC_ASCII_VECTOR("getPropertyDescriptor")); |
3634 Handle<Object> args[] = { handler, trap, name }; | 3634 Handle<Object> args[] = { handler, trap, name }; |
3635 Handle<Object> error = isolate->factory()->NewTypeError( | 3635 Handle<Object> error = isolate->factory()->NewTypeError( |
3636 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); | 3636 "proxy_prop_not_configurable", HandleVector(args, arraysize(args))); |
3637 isolate->Throw(*error); | 3637 isolate->Throw(*error); |
3638 return maybe(NONE); | 3638 return maybe(NONE); |
3639 } | 3639 } |
3640 | 3640 |
3641 int attributes = NONE; | 3641 int attributes = NONE; |
3642 if (!enumerable->BooleanValue()) attributes |= DONT_ENUM; | 3642 if (!enumerable->BooleanValue()) attributes |= DONT_ENUM; |
3643 if (!configurable->BooleanValue()) attributes |= DONT_DELETE; | 3643 if (!configurable->BooleanValue()) attributes |= DONT_DELETE; |
3644 if (!writable->BooleanValue()) attributes |= READ_ONLY; | 3644 if (!writable->BooleanValue()) attributes |= READ_ONLY; |
3645 return maybe(static_cast<PropertyAttributes>(attributes)); | 3645 return maybe(static_cast<PropertyAttributes>(attributes)); |
3646 } | 3646 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3688 Handle<Object> trap; | 3688 Handle<Object> trap; |
3689 ASSIGN_RETURN_ON_EXCEPTION( | 3689 ASSIGN_RETURN_ON_EXCEPTION( |
3690 isolate, trap, | 3690 isolate, trap, |
3691 Object::GetPropertyOrElement(handler, trap_name), | 3691 Object::GetPropertyOrElement(handler, trap_name), |
3692 Object); | 3692 Object); |
3693 | 3693 |
3694 if (trap->IsUndefined()) { | 3694 if (trap->IsUndefined()) { |
3695 if (derived.is_null()) { | 3695 if (derived.is_null()) { |
3696 Handle<Object> args[] = { handler, trap_name }; | 3696 Handle<Object> args[] = { handler, trap_name }; |
3697 Handle<Object> error = isolate->factory()->NewTypeError( | 3697 Handle<Object> error = isolate->factory()->NewTypeError( |
3698 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); | 3698 "handler_trap_missing", HandleVector(args, arraysize(args))); |
3699 return isolate->Throw<Object>(error); | 3699 return isolate->Throw<Object>(error); |
3700 } | 3700 } |
3701 trap = Handle<Object>(derived); | 3701 trap = Handle<Object>(derived); |
3702 } | 3702 } |
3703 | 3703 |
3704 return Execution::Call(isolate, trap, handler, argc, argv); | 3704 return Execution::Call(isolate, trap, handler, argc, argv); |
3705 } | 3705 } |
3706 | 3706 |
3707 | 3707 |
3708 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { | 3708 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4951 if (it.isolate()->has_pending_exception()) return maybe_result; | 4951 if (it.isolate()->has_pending_exception()) return maybe_result; |
4952 break; | 4952 break; |
4953 } | 4953 } |
4954 case LookupIterator::PROPERTY: { | 4954 case LookupIterator::PROPERTY: { |
4955 if (!it.HasProperty()) continue; | 4955 if (!it.HasProperty()) continue; |
4956 if (delete_mode != FORCE_DELETION && !it.IsConfigurable()) { | 4956 if (delete_mode != FORCE_DELETION && !it.IsConfigurable()) { |
4957 // Fail if the property is not configurable. | 4957 // Fail if the property is not configurable. |
4958 if (delete_mode == STRICT_DELETION) { | 4958 if (delete_mode == STRICT_DELETION) { |
4959 Handle<Object> args[2] = {name, object}; | 4959 Handle<Object> args[2] = {name, object}; |
4960 Handle<Object> error = it.isolate()->factory()->NewTypeError( | 4960 Handle<Object> error = it.isolate()->factory()->NewTypeError( |
4961 "strict_delete_property", HandleVector(args, ARRAY_SIZE(args))); | 4961 "strict_delete_property", HandleVector(args, arraysize(args))); |
4962 it.isolate()->Throw(*error); | 4962 it.isolate()->Throw(*error); |
4963 return Handle<Object>(); | 4963 return Handle<Object>(); |
4964 } | 4964 } |
4965 return it.isolate()->factory()->false_value(); | 4965 return it.isolate()->factory()->false_value(); |
4966 } | 4966 } |
4967 | 4967 |
4968 Handle<Object> old_value; | 4968 Handle<Object> old_value; |
4969 if (is_observed) { | 4969 if (is_observed) { |
4970 switch (it.property_kind()) { | 4970 switch (it.property_kind()) { |
4971 case LookupIterator::ACCESSOR: | 4971 case LookupIterator::ACCESSOR: |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5816 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 5816 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
5817 Handle<JSProxy> proxy(JSProxy::cast(*PrototypeIterator::GetCurrent(iter)), | 5817 Handle<JSProxy> proxy(JSProxy::cast(*PrototypeIterator::GetCurrent(iter)), |
5818 isolate); | 5818 isolate); |
5819 Handle<Object> args[] = { proxy }; | 5819 Handle<Object> args[] = { proxy }; |
5820 Handle<Object> names; | 5820 Handle<Object> names; |
5821 ASSIGN_RETURN_ON_EXCEPTION( | 5821 ASSIGN_RETURN_ON_EXCEPTION( |
5822 isolate, names, | 5822 isolate, names, |
5823 Execution::Call(isolate, | 5823 Execution::Call(isolate, |
5824 isolate->proxy_enumerate(), | 5824 isolate->proxy_enumerate(), |
5825 object, | 5825 object, |
5826 ARRAY_SIZE(args), | 5826 arraysize(args), |
5827 args), | 5827 args), |
5828 FixedArray); | 5828 FixedArray); |
5829 ASSIGN_RETURN_ON_EXCEPTION( | 5829 ASSIGN_RETURN_ON_EXCEPTION( |
5830 isolate, content, | 5830 isolate, content, |
5831 FixedArray::AddKeysFromArrayLike( | 5831 FixedArray::AddKeysFromArrayLike( |
5832 content, Handle<JSObject>::cast(names)), | 5832 content, Handle<JSObject>::cast(names)), |
5833 FixedArray); | 5833 FixedArray); |
5834 break; | 5834 break; |
5835 } | 5835 } |
5836 | 5836 |
(...skipping 5324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11161 Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index); | 11161 Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index); |
11162 Handle<Object> add_count_object = | 11162 Handle<Object> add_count_object = |
11163 isolate->factory()->NewNumberFromUint(add_count); | 11163 isolate->factory()->NewNumberFromUint(add_count); |
11164 | 11164 |
11165 Handle<Object> args[] = | 11165 Handle<Object> args[] = |
11166 { object, index_object, deleted, add_count_object }; | 11166 { object, index_object, deleted, add_count_object }; |
11167 | 11167 |
11168 Execution::Call(isolate, | 11168 Execution::Call(isolate, |
11169 Handle<JSFunction>(isolate->observers_enqueue_splice()), | 11169 Handle<JSFunction>(isolate->observers_enqueue_splice()), |
11170 isolate->factory()->undefined_value(), | 11170 isolate->factory()->undefined_value(), |
11171 ARRAY_SIZE(args), | 11171 arraysize(args), |
11172 args).Assert(); | 11172 args).Assert(); |
11173 } | 11173 } |
11174 | 11174 |
11175 | 11175 |
11176 static void BeginPerformSplice(Handle<JSArray> object) { | 11176 static void BeginPerformSplice(Handle<JSArray> object) { |
11177 Isolate* isolate = object->GetIsolate(); | 11177 Isolate* isolate = object->GetIsolate(); |
11178 HandleScope scope(isolate); | 11178 HandleScope scope(isolate); |
11179 Handle<Object> args[] = { object }; | 11179 Handle<Object> args[] = { object }; |
11180 | 11180 |
11181 Execution::Call(isolate, | 11181 Execution::Call(isolate, |
11182 Handle<JSFunction>(isolate->observers_begin_perform_splice()), | 11182 Handle<JSFunction>(isolate->observers_begin_perform_splice()), |
11183 isolate->factory()->undefined_value(), | 11183 isolate->factory()->undefined_value(), |
11184 ARRAY_SIZE(args), | 11184 arraysize(args), |
11185 args).Assert(); | 11185 args).Assert(); |
11186 } | 11186 } |
11187 | 11187 |
11188 | 11188 |
11189 static void EndPerformSplice(Handle<JSArray> object) { | 11189 static void EndPerformSplice(Handle<JSArray> object) { |
11190 Isolate* isolate = object->GetIsolate(); | 11190 Isolate* isolate = object->GetIsolate(); |
11191 HandleScope scope(isolate); | 11191 HandleScope scope(isolate); |
11192 Handle<Object> args[] = { object }; | 11192 Handle<Object> args[] = { object }; |
11193 | 11193 |
11194 Execution::Call(isolate, | 11194 Execution::Call(isolate, |
11195 Handle<JSFunction>(isolate->observers_end_perform_splice()), | 11195 Handle<JSFunction>(isolate->observers_end_perform_splice()), |
11196 isolate->factory()->undefined_value(), | 11196 isolate->factory()->undefined_value(), |
11197 ARRAY_SIZE(args), | 11197 arraysize(args), |
11198 args).Assert(); | 11198 args).Assert(); |
11199 } | 11199 } |
11200 | 11200 |
11201 | 11201 |
11202 MaybeHandle<Object> JSArray::SetElementsLength( | 11202 MaybeHandle<Object> JSArray::SetElementsLength( |
11203 Handle<JSArray> array, | 11203 Handle<JSArray> array, |
11204 Handle<Object> new_length_handle) { | 11204 Handle<Object> new_length_handle) { |
11205 if (array->HasFastElements()) { | 11205 if (array->HasFastElements()) { |
11206 // If the new array won't fit in a some non-trivial fraction of the max old | 11206 // If the new array won't fit in a some non-trivial fraction of the max old |
11207 // space size, then force it to go dictionary mode. | 11207 // space size, then force it to go dictionary mode. |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11707 // ... | 11707 // ... |
11708 // In addition, if [[Extensible]] is false the value of the [[Class]] and | 11708 // In addition, if [[Extensible]] is false the value of the [[Class]] and |
11709 // [[Prototype]] internal properties of the object may not be modified. | 11709 // [[Prototype]] internal properties of the object may not be modified. |
11710 // ... | 11710 // ... |
11711 // Implementation specific extensions that modify [[Class]], [[Prototype]] | 11711 // Implementation specific extensions that modify [[Class]], [[Prototype]] |
11712 // or [[Extensible]] must not violate the invariants defined in the preceding | 11712 // or [[Extensible]] must not violate the invariants defined in the preceding |
11713 // paragraph. | 11713 // paragraph. |
11714 if (!object->map()->is_extensible()) { | 11714 if (!object->map()->is_extensible()) { |
11715 Handle<Object> args[] = { object }; | 11715 Handle<Object> args[] = { object }; |
11716 Handle<Object> error = isolate->factory()->NewTypeError( | 11716 Handle<Object> error = isolate->factory()->NewTypeError( |
11717 "non_extensible_proto", HandleVector(args, ARRAY_SIZE(args))); | 11717 "non_extensible_proto", HandleVector(args, arraysize(args))); |
11718 return isolate->Throw<Object>(error); | 11718 return isolate->Throw<Object>(error); |
11719 } | 11719 } |
11720 | 11720 |
11721 // Before we can set the prototype we need to be sure | 11721 // Before we can set the prototype we need to be sure |
11722 // prototype cycles are prevented. | 11722 // prototype cycles are prevented. |
11723 // It is sufficient to validate that the receiver is not in the new prototype | 11723 // It is sufficient to validate that the receiver is not in the new prototype |
11724 // chain. | 11724 // chain. |
11725 for (PrototypeIterator iter(isolate, *value, | 11725 for (PrototypeIterator iter(isolate, *value, |
11726 PrototypeIterator::START_AT_RECEIVER); | 11726 PrototypeIterator::START_AT_RECEIVER); |
11727 !iter.IsAtEnd(); iter.Advance()) { | 11727 !iter.IsAtEnd(); iter.Advance()) { |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12406 value, attributes, strict_mode, check_prototype, set_mode); | 12406 value, attributes, strict_mode, check_prototype, set_mode); |
12407 } | 12407 } |
12408 | 12408 |
12409 // Don't allow element properties to be redefined for external arrays. | 12409 // Don't allow element properties to be redefined for external arrays. |
12410 if ((object->HasExternalArrayElements() || | 12410 if ((object->HasExternalArrayElements() || |
12411 object->HasFixedTypedArrayElements()) && | 12411 object->HasFixedTypedArrayElements()) && |
12412 set_mode == DEFINE_PROPERTY) { | 12412 set_mode == DEFINE_PROPERTY) { |
12413 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 12413 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
12414 Handle<Object> args[] = { object, number }; | 12414 Handle<Object> args[] = { object, number }; |
12415 Handle<Object> error = isolate->factory()->NewTypeError( | 12415 Handle<Object> error = isolate->factory()->NewTypeError( |
12416 "redef_external_array_element", HandleVector(args, ARRAY_SIZE(args))); | 12416 "redef_external_array_element", HandleVector(args, arraysize(args))); |
12417 return isolate->Throw<Object>(error); | 12417 return isolate->Throw<Object>(error); |
12418 } | 12418 } |
12419 | 12419 |
12420 // Normalize the elements to enable attributes on the property. | 12420 // Normalize the elements to enable attributes on the property. |
12421 if ((attributes & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) { | 12421 if ((attributes & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) { |
12422 Handle<SeededNumberDictionary> dictionary = NormalizeElements(object); | 12422 Handle<SeededNumberDictionary> dictionary = NormalizeElements(object); |
12423 // Make sure that we never go back to fast case. | 12423 // Make sure that we never go back to fast case. |
12424 dictionary->set_requires_slow_elements(); | 12424 dictionary->set_requires_slow_elements(); |
12425 } | 12425 } |
12426 | 12426 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12860 } | 12860 } |
12861 return false; | 12861 return false; |
12862 } | 12862 } |
12863 | 12863 |
12864 | 12864 |
12865 MaybeHandle<Object> JSArray::ReadOnlyLengthError(Handle<JSArray> array) { | 12865 MaybeHandle<Object> JSArray::ReadOnlyLengthError(Handle<JSArray> array) { |
12866 Isolate* isolate = array->GetIsolate(); | 12866 Isolate* isolate = array->GetIsolate(); |
12867 Handle<Name> length = isolate->factory()->length_string(); | 12867 Handle<Name> length = isolate->factory()->length_string(); |
12868 Handle<Object> args[2] = { length, array }; | 12868 Handle<Object> args[2] = { length, array }; |
12869 Handle<Object> error = isolate->factory()->NewTypeError( | 12869 Handle<Object> error = isolate->factory()->NewTypeError( |
12870 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); | 12870 "strict_read_only_property", HandleVector(args, arraysize(args))); |
12871 return isolate->Throw<Object>(error); | 12871 return isolate->Throw<Object>(error); |
12872 } | 12872 } |
12873 | 12873 |
12874 | 12874 |
12875 MaybeHandle<Object> JSObject::GetElementWithInterceptor( | 12875 MaybeHandle<Object> JSObject::GetElementWithInterceptor( |
12876 Handle<JSObject> object, | 12876 Handle<JSObject> object, |
12877 Handle<Object> receiver, | 12877 Handle<Object> receiver, |
12878 uint32_t index) { | 12878 uint32_t index) { |
12879 Isolate* isolate = object->GetIsolate(); | 12879 Isolate* isolate = object->GetIsolate(); |
12880 | 12880 |
(...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16428 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16428 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16429 static const char* error_messages_[] = { | 16429 static const char* error_messages_[] = { |
16430 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16430 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16431 }; | 16431 }; |
16432 #undef ERROR_MESSAGES_TEXTS | 16432 #undef ERROR_MESSAGES_TEXTS |
16433 return error_messages_[reason]; | 16433 return error_messages_[reason]; |
16434 } | 16434 } |
16435 | 16435 |
16436 | 16436 |
16437 } } // namespace v8::internal | 16437 } } // namespace v8::internal |
OLD | NEW |