Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: src/runtime/runtime-function.cc

Issue 1180873002: Bound functions should also have configurable length (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1419.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 bound_function->set_function_bindings(*new_bindings); 439 bound_function->set_function_bindings(*new_bindings);
440 440
441 // Update length. Have to remove the prototype first so that map migration 441 // Update length. Have to remove the prototype first so that map migration
442 // is happy about the number of fields. 442 // is happy about the number of fields.
443 RUNTIME_ASSERT(bound_function->RemovePrototype()); 443 RUNTIME_ASSERT(bound_function->RemovePrototype());
444 Handle<Map> bound_function_map( 444 Handle<Map> bound_function_map(
445 isolate->native_context()->bound_function_map()); 445 isolate->native_context()->bound_function_map());
446 JSObject::MigrateToMap(bound_function, bound_function_map); 446 JSObject::MigrateToMap(bound_function, bound_function_map);
447 Handle<String> length_string = isolate->factory()->length_string(); 447 Handle<String> length_string = isolate->factory()->length_string();
448 PropertyAttributes attr = 448 PropertyAttributes attr =
449 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY); 449 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
450 RETURN_FAILURE_ON_EXCEPTION( 450 RETURN_FAILURE_ON_EXCEPTION(
451 isolate, JSObject::SetOwnPropertyIgnoreAttributes( 451 isolate, JSObject::SetOwnPropertyIgnoreAttributes(
452 bound_function, length_string, new_length, attr)); 452 bound_function, length_string, new_length, attr));
453 return *bound_function; 453 return *bound_function;
454 } 454 }
455 455
456 456
457 RUNTIME_FUNCTION(Runtime_BoundFunctionGetBindings) { 457 RUNTIME_FUNCTION(Runtime_BoundFunctionGetBindings) {
458 HandleScope handles(isolate); 458 HandleScope handles(isolate);
459 DCHECK(args.length() == 1); 459 DCHECK(args.length() == 1);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 623
624 624
625 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { 625 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) {
626 HandleScope scope(isolate); 626 HandleScope scope(isolate);
627 DCHECK(args.length() == 0); 627 DCHECK(args.length() == 0);
628 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 628 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
629 NewTypeError(MessageTemplate::kStrongArity)); 629 NewTypeError(MessageTemplate::kStrongArity));
630 } 630 }
631 } // namespace internal 631 } // namespace internal
632 } // namespace v8 632 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1419.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698