| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 DisallowHeapAllocation no_gc; | 604 DisallowHeapAllocation no_gc; |
| 605 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); | 605 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |
| 606 for (int index = 0; index < length; ++index) { | 606 for (int index = 0; index < length; ++index) { |
| 607 result->set(index, frame[offset - index], mode); | 607 result->set(index, frame[offset - index], mode); |
| 608 } | 608 } |
| 609 return *result; | 609 return *result; |
| 610 } | 610 } |
| 611 | 611 |
| 612 RUNTIME_FUNCTION(Runtime_NewClosure) { | 612 RUNTIME_FUNCTION(Runtime_NewClosure) { |
| 613 HandleScope scope(isolate); | 613 HandleScope scope(isolate); |
| 614 DCHECK_EQ(1, args.length()); | 614 DCHECK_EQ(3, args.length()); |
| 615 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 615 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
| 616 Handle<Context> context(isolate->context(), isolate); | 616 Handle<Context> context(isolate->context(), isolate); |
| 617 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 617 Handle<JSFunction> function = |
| 618 NOT_TENURED); | 618 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, |
| 619 NOT_TENURED); |
| 620 return *function; |
| 619 } | 621 } |
| 620 | 622 |
| 621 | 623 |
| 622 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { | 624 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { |
| 623 HandleScope scope(isolate); | 625 HandleScope scope(isolate); |
| 624 DCHECK_EQ(1, args.length()); | 626 DCHECK_EQ(3, args.length()); |
| 625 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 627 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
| 626 Handle<Context> context(isolate->context(), isolate); | 628 Handle<Context> context(isolate->context(), isolate); |
| 627 // The caller ensures that we pretenure closures that are assigned | 629 // The caller ensures that we pretenure closures that are assigned |
| 628 // directly to properties. | 630 // directly to properties. |
| 629 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 631 Handle<JSFunction> function = |
| 630 TENURED); | 632 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, |
| 633 TENURED); |
| 634 return *function; |
| 631 } | 635 } |
| 632 | 636 |
| 633 static Object* FindNameClash(Handle<ScopeInfo> scope_info, | 637 static Object* FindNameClash(Handle<ScopeInfo> scope_info, |
| 634 Handle<JSGlobalObject> global_object, | 638 Handle<JSGlobalObject> global_object, |
| 635 Handle<ScriptContextTable> script_context) { | 639 Handle<ScriptContextTable> script_context) { |
| 636 Isolate* isolate = scope_info->GetIsolate(); | 640 Isolate* isolate = scope_info->GetIsolate(); |
| 637 for (int var = 0; var < scope_info->ContextLocalCount(); var++) { | 641 for (int var = 0; var < scope_info->ContextLocalCount(); var++) { |
| 638 Handle<String> name(scope_info->ContextLocalName(var)); | 642 Handle<String> name(scope_info->ContextLocalName(var)); |
| 639 VariableMode mode = scope_info->ContextLocalMode(var); | 643 VariableMode mode = scope_info->ContextLocalMode(var); |
| 640 ScriptContextTable::LookupResult lookup; | 644 ScriptContextTable::LookupResult lookup; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 979 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
| 976 HandleScope scope(isolate); | 980 HandleScope scope(isolate); |
| 977 DCHECK_EQ(2, args.length()); | 981 DCHECK_EQ(2, args.length()); |
| 978 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 979 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 983 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 980 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 984 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
| 981 } | 985 } |
| 982 | 986 |
| 983 } // namespace internal | 987 } // namespace internal |
| 984 } // namespace v8 | 988 } // namespace v8 |
| OLD | NEW |