| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.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/frames-inl.h" | 9 #include "src/frames-inl.h" | 
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" | 
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 549 RUNTIME_FUNCTION(Runtime_NewStrictArguments) { | 549 RUNTIME_FUNCTION(Runtime_NewStrictArguments) { | 
| 550   HandleScope scope(isolate); | 550   HandleScope scope(isolate); | 
| 551   DCHECK(args.length() == 3); | 551   DCHECK(args.length() == 3); | 
| 552   CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0) | 552   CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0) | 
| 553   Object** parameters = reinterpret_cast<Object**>(args[1]); | 553   Object** parameters = reinterpret_cast<Object**>(args[1]); | 
| 554   CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 554   CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 
| 555   return *NewStrictArguments(isolate, callee, parameters, argument_count); | 555   return *NewStrictArguments(isolate, callee, parameters, argument_count); | 
| 556 } | 556 } | 
| 557 | 557 | 
| 558 | 558 | 
| 559 static Handle<JSArray> NewRestParam(Isolate* isolate, Object** parameters, |  | 
| 560                                     int num_params, int rest_index, |  | 
| 561                                     LanguageMode language_mode) { |  | 
| 562   parameters -= rest_index; |  | 
| 563   int num_elements = std::max(0, num_params - rest_index); |  | 
| 564   Handle<FixedArray> elements = |  | 
| 565       isolate->factory()->NewUninitializedFixedArray(num_elements); |  | 
| 566   for (int i = 0; i < num_elements; ++i) { |  | 
| 567     elements->set(i, *--parameters); |  | 
| 568   } |  | 
| 569   return isolate->factory()->NewJSArrayWithElements( |  | 
| 570       elements, FAST_ELEMENTS, num_elements, strength(language_mode)); |  | 
| 571 } |  | 
| 572 |  | 
| 573 |  | 
| 574 RUNTIME_FUNCTION(Runtime_NewRestParam) { |  | 
| 575   HandleScope scope(isolate); |  | 
| 576   DCHECK(args.length() == 4); |  | 
| 577   Object** parameters = reinterpret_cast<Object**>(args[0]); |  | 
| 578   CONVERT_SMI_ARG_CHECKED(num_params, 1); |  | 
| 579   CONVERT_SMI_ARG_CHECKED(rest_index, 2); |  | 
| 580   CONVERT_SMI_ARG_CHECKED(language_mode, 3); |  | 
| 581 |  | 
| 582   return *NewRestParam(isolate, parameters, num_params, rest_index, |  | 
| 583                        static_cast<LanguageMode>(language_mode)); |  | 
| 584 } |  | 
| 585 |  | 
| 586 |  | 
| 587 RUNTIME_FUNCTION(Runtime_NewRestParamSlow) { |  | 
| 588   HandleScope scope(isolate); |  | 
| 589   DCHECK(args.length() == 2); |  | 
| 590   CONVERT_SMI_ARG_CHECKED(rest_index, 0); |  | 
| 591   CONVERT_SMI_ARG_CHECKED(language_mode, 1); |  | 
| 592 |  | 
| 593   JavaScriptFrameIterator it(isolate); |  | 
| 594 |  | 
| 595   // Find the frame that holds the actual arguments passed to the function. |  | 
| 596   it.AdvanceToArgumentsFrame(); |  | 
| 597   JavaScriptFrame* frame = it.frame(); |  | 
| 598 |  | 
| 599   int argument_count = frame->GetArgumentsLength(); |  | 
| 600   Object** parameters = reinterpret_cast<Object**>(frame->GetParameterSlot(-1)); |  | 
| 601 |  | 
| 602   return *NewRestParam(isolate, parameters, argument_count, rest_index, |  | 
| 603                        static_cast<LanguageMode>(language_mode)); |  | 
| 604 } |  | 
| 605 |  | 
| 606 |  | 
| 607 RUNTIME_FUNCTION(Runtime_NewClosureFromStubFailure) { | 559 RUNTIME_FUNCTION(Runtime_NewClosureFromStubFailure) { | 
| 608   HandleScope scope(isolate); | 560   HandleScope scope(isolate); | 
| 609   DCHECK(args.length() == 1); | 561   DCHECK(args.length() == 1); | 
| 610   CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 562   CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 
| 611   Handle<Context> context(isolate->context()); | 563   Handle<Context> context(isolate->context()); | 
| 612   PretenureFlag pretenure_flag = NOT_TENURED; | 564   PretenureFlag pretenure_flag = NOT_TENURED; | 
| 613   return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 565   return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 
| 614                                                                 pretenure_flag); | 566                                                                 pretenure_flag); | 
| 615 } | 567 } | 
| 616 | 568 | 
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1172 | 1124 | 
| 1173   // Lookup in the initial Object.prototype object. | 1125   // Lookup in the initial Object.prototype object. | 
| 1174   Handle<Object> result; | 1126   Handle<Object> result; | 
| 1175   ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1127   ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 
| 1176       isolate, result, | 1128       isolate, result, | 
| 1177       Object::GetProperty(isolate->initial_object_prototype(), key)); | 1129       Object::GetProperty(isolate->initial_object_prototype(), key)); | 
| 1178   return *result; | 1130   return *result; | 
| 1179 } | 1131 } | 
| 1180 }  // namespace internal | 1132 }  // namespace internal | 
| 1181 }  // namespace v8 | 1133 }  // namespace v8 | 
| OLD | NEW | 
|---|