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

Side by Side Diff: src/runtime.cc

Issue 253603003: Pass in the prototype to CreateApiFunction rather than setting it on the result. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« src/factory.cc ('K') | « src/runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); 2127 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2);
2128 Handle<Object> result; 2128 Handle<Object> result;
2129 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2129 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2130 isolate, result, RegExpImpl::Compile(re, pattern, flags)); 2130 isolate, result, RegExpImpl::Compile(re, pattern, flags));
2131 return *result; 2131 return *result;
2132 } 2132 }
2133 2133
2134 2134
2135 RUNTIME_FUNCTION(Runtime_CreateApiFunction) { 2135 RUNTIME_FUNCTION(Runtime_CreateApiFunction) {
2136 HandleScope scope(isolate); 2136 HandleScope scope(isolate);
2137 ASSERT(args.length() == 1); 2137 ASSERT(args.length() == 2);
2138 CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0); 2138 CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0);
2139 return *isolate->factory()->CreateApiFunction(data); 2139 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
2140 return *isolate->factory()->CreateApiFunction(data, prototype);
2140 } 2141 }
2141 2142
2142 2143
2143 RUNTIME_FUNCTION(Runtime_IsTemplate) { 2144 RUNTIME_FUNCTION(Runtime_IsTemplate) {
2144 SealHandleScope shs(isolate); 2145 SealHandleScope shs(isolate);
2145 ASSERT(args.length() == 1); 2146 ASSERT(args.length() == 1);
2146 CONVERT_ARG_HANDLE_CHECKED(Object, arg, 0); 2147 CONVERT_ARG_HANDLE_CHECKED(Object, arg, 0);
2147 bool result = arg->IsObjectTemplateInfo() || arg->IsFunctionTemplateInfo(); 2148 bool result = arg->IsObjectTemplateInfo() || arg->IsFunctionTemplateInfo();
2148 return isolate->heap()->ToBoolean(result); 2149 return isolate->heap()->ToBoolean(result);
2149 } 2150 }
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 } 2799 }
2799 2800
2800 2801
2801 static Handle<JSFunction> InstallBuiltin(Isolate* isolate, 2802 static Handle<JSFunction> InstallBuiltin(Isolate* isolate,
2802 Handle<JSObject> holder, 2803 Handle<JSObject> holder,
2803 const char* name, 2804 const char* name,
2804 Builtins::Name builtin_name) { 2805 Builtins::Name builtin_name) {
2805 Handle<String> key = isolate->factory()->InternalizeUtf8String(name); 2806 Handle<String> key = isolate->factory()->InternalizeUtf8String(name);
2806 Handle<Code> code(isolate->builtins()->builtin(builtin_name)); 2807 Handle<Code> code(isolate->builtins()->builtin(builtin_name));
2807 Handle<JSFunction> optimized = 2808 Handle<JSFunction> optimized =
2808 isolate->factory()->NewFunction(key, 2809 isolate->factory()->NewFunction(MaybeHandle<Object>(),
2810 key,
2809 JS_OBJECT_TYPE, 2811 JS_OBJECT_TYPE,
2810 JSObject::kHeaderSize, 2812 JSObject::kHeaderSize,
2811 code, 2813 code,
2812 false); 2814 false);
2813 optimized->shared()->DontAdaptArguments(); 2815 optimized->shared()->DontAdaptArguments();
2814 JSReceiver::SetProperty(holder, key, optimized, NONE, STRICT).Assert(); 2816 JSReceiver::SetProperty(holder, key, optimized, NONE, STRICT).Assert();
2815 return optimized; 2817 return optimized;
2816 } 2818 }
2817 2819
2818 2820
(...skipping 12324 matching lines...) Expand 10 before | Expand all | Expand 10 after
15143 } 15145 }
15144 return NULL; 15146 return NULL;
15145 } 15147 }
15146 15148
15147 15149
15148 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15150 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15149 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15151 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15150 } 15152 }
15151 15153
15152 } } // namespace v8::internal 15154 } } // namespace v8::internal
OLDNEW
« src/factory.cc ('K') | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698