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

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

Issue 712333003: Revert "Classes: Add support for arguments in default constructor" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('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 <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/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Sloppy) { 441 RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Sloppy) {
442 HandleScope scope(isolate); 442 HandleScope scope(isolate);
443 DCHECK(args.length() == 4); 443 DCHECK(args.length() == 4);
444 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); 444 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
445 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); 445 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
446 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2); 446 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
447 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3); 447 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
448 448
449 return StoreKeyedToSuper(isolate, home_object, receiver, key, value, SLOPPY); 449 return StoreKeyedToSuper(isolate, home_object, receiver, key, value, SLOPPY);
450 } 450 }
451
452
453 RUNTIME_FUNCTION(Runtime_DefaultConstructorSuperCall) {
454 HandleScope scope(isolate);
455 DCHECK(args.length() == 0);
456
457 // Compute the frame holding the arguments.
458 JavaScriptFrameIterator it(isolate);
459 it.AdvanceToArgumentsFrame();
460 JavaScriptFrame* frame = it.frame();
461
462 Handle<JSFunction> function(frame->function(), isolate);
463 Handle<Object> receiver(frame->receiver(), isolate);
464
465 Handle<Object> proto_function;
466 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, proto_function,
467 Runtime::GetPrototype(isolate, function));
468
469 // Get the actual number of provided arguments.
470 const int argc = frame->ComputeParametersCount();
471
472 // Loose upper bound to allow fuzzing. We'll most likely run out of
473 // stack space before hitting this limit.
474 static int kMaxArgc = 1000000;
475 RUNTIME_ASSERT(argc >= 0 && argc <= kMaxArgc);
476
477 // If there are too many arguments, allocate argv via malloc.
478 const int argv_small_size = 10;
479 Handle<Object> argv_small_buffer[argv_small_size];
480 SmartArrayPointer<Handle<Object> > argv_large_buffer;
481 Handle<Object>* argv = argv_small_buffer;
482 if (argc > argv_small_size) {
483 argv = new Handle<Object>[argc];
484 if (argv == NULL) return isolate->StackOverflow();
485 argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv);
486 }
487
488 for (int i = 0; i < argc; ++i) {
489 argv[i] = handle(frame->GetParameter(i), isolate);
490 }
491
492 Handle<Object> result;
493 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
494 isolate, result,
495 Execution::Call(isolate, proto_function, receiver, argc, argv, false));
496 return *result;
497 }
498 } 451 }
499 } // namespace v8::internal 452 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698