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

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

Issue 1329293003: [runtime] Sanitize %NewClosure runtime entries. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Ports Created 5 years, 3 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 | « src/runtime/runtime.h ('k') | src/x64/lithium-codegen-x64.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 "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
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 RUNTIME_FUNCTION(Runtime_NewClosureFromStubFailure) {
560 HandleScope scope(isolate);
561 DCHECK(args.length() == 1);
562 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
563 Handle<Context> context(isolate->context());
564 PretenureFlag pretenure_flag = NOT_TENURED;
565 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
566 pretenure_flag);
567 }
568
569
570 RUNTIME_FUNCTION(Runtime_NewClosure) { 559 RUNTIME_FUNCTION(Runtime_NewClosure) {
571 HandleScope scope(isolate); 560 HandleScope scope(isolate);
572 DCHECK(args.length() == 3); 561 DCHECK_EQ(1, args.length());
573 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); 562 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
574 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); 563 Handle<Context> context(isolate->context(), isolate);
575 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); 564 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
565 NOT_TENURED);
566 }
576 567
568
569 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) {
570 HandleScope scope(isolate);
571 DCHECK_EQ(1, args.length());
572 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
573 Handle<Context> context(isolate->context(), isolate);
577 // The caller ensures that we pretenure closures that are assigned 574 // The caller ensures that we pretenure closures that are assigned
578 // directly to properties. 575 // directly to properties.
579 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED;
580 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, 576 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
581 pretenure_flag); 577 TENURED);
582 } 578 }
583 579
584 static Object* FindNameClash(Handle<ScopeInfo> scope_info, 580 static Object* FindNameClash(Handle<ScopeInfo> scope_info,
585 Handle<GlobalObject> global_object, 581 Handle<GlobalObject> global_object,
586 Handle<ScriptContextTable> script_context) { 582 Handle<ScriptContextTable> script_context) {
587 Isolate* isolate = scope_info->GetIsolate(); 583 Isolate* isolate = scope_info->GetIsolate();
588 for (int var = 0; var < scope_info->ContextLocalCount(); var++) { 584 for (int var = 0; var < scope_info->ContextLocalCount(); var++) {
589 Handle<String> name(scope_info->ContextLocalName(var)); 585 Handle<String> name(scope_info->ContextLocalName(var));
590 VariableMode mode = scope_info->ContextLocalMode(var); 586 VariableMode mode = scope_info->ContextLocalMode(var);
591 ScriptContextTable::LookupResult lookup; 587 ScriptContextTable::LookupResult lookup;
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 1118
1123 // Lookup in the initial Object.prototype object. 1119 // Lookup in the initial Object.prototype object.
1124 Handle<Object> result; 1120 Handle<Object> result;
1125 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1121 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1126 isolate, result, 1122 isolate, result,
1127 Object::GetProperty(isolate->initial_object_prototype(), key)); 1123 Object::GetProperty(isolate->initial_object_prototype(), key));
1128 return *result; 1124 return *result;
1129 } 1125 }
1130 } // namespace internal 1126 } // namespace internal
1131 } // namespace v8 1127 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698