OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 new_bindings->set_map_no_write_barrier(isolate->heap()->fixed_array_map()); | 440 new_bindings->set_map_no_write_barrier(isolate->heap()->fixed_array_map()); |
441 bound_function->set_function_bindings(*new_bindings); | 441 bound_function->set_function_bindings(*new_bindings); |
442 | 442 |
443 // Update length. Have to remove the prototype first so that map migration | 443 // Update length. Have to remove the prototype first so that map migration |
444 // is happy about the number of fields. | 444 // is happy about the number of fields. |
445 RUNTIME_ASSERT(bound_function->RemovePrototype()); | 445 RUNTIME_ASSERT(bound_function->RemovePrototype()); |
446 Handle<Map> bound_function_map( | 446 Handle<Map> bound_function_map( |
447 isolate->native_context()->bound_function_map()); | 447 isolate->native_context()->bound_function_map()); |
448 JSObject::MigrateToMap(bound_function, bound_function_map); | 448 JSObject::MigrateToMap(bound_function, bound_function_map); |
449 Handle<String> length_string = isolate->factory()->length_string(); | 449 Handle<String> length_string = isolate->factory()->length_string(); |
| 450 // These attributes must be kept in sync with how the bootstrapper |
| 451 // configures the bound_function_map retrieved above. |
| 452 // We use ...IgnoreAttributes() here because of length's read-onliness. |
450 PropertyAttributes attr = | 453 PropertyAttributes attr = |
451 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 454 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
452 RETURN_FAILURE_ON_EXCEPTION( | 455 RETURN_FAILURE_ON_EXCEPTION( |
453 isolate, JSObject::SetOwnPropertyIgnoreAttributes( | 456 isolate, JSObject::SetOwnPropertyIgnoreAttributes( |
454 bound_function, length_string, new_length, attr)); | 457 bound_function, length_string, new_length, attr)); |
455 return *bound_function; | 458 return *bound_function; |
456 } | 459 } |
457 | 460 |
458 | 461 |
459 RUNTIME_FUNCTION(Runtime_BoundFunctionGetBindings) { | 462 RUNTIME_FUNCTION(Runtime_BoundFunctionGetBindings) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 628 |
626 | 629 |
627 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 630 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
628 HandleScope scope(isolate); | 631 HandleScope scope(isolate); |
629 DCHECK(args.length() == 0); | 632 DCHECK(args.length() == 0); |
630 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 633 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
631 NewTypeError(MessageTemplate::kStrongArity)); | 634 NewTypeError(MessageTemplate::kStrongArity)); |
632 } | 635 } |
633 } // namespace internal | 636 } // namespace internal |
634 } // namespace v8 | 637 } // namespace v8 |
OLD | NEW |