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

Side by Side Diff: src/objects.cc

Issue 2095953002: Refactor CreateApiFunction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Create the template instantiation cache early enough Created 4 years, 5 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/objects.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 5205 matching lines...) Expand 10 before | Expand all | Expand 10 after
5216 if (!function->bound_target_function()->IsJSFunction()) return prefix; 5216 if (!function->bound_target_function()->IsJSFunction()) return prefix;
5217 Handle<JSFunction> target(JSFunction::cast(function->bound_target_function()), 5217 Handle<JSFunction> target(JSFunction::cast(function->bound_target_function()),
5218 isolate); 5218 isolate);
5219 Handle<Object> target_name = JSFunction::GetName(isolate, target); 5219 Handle<Object> target_name = JSFunction::GetName(isolate, target);
5220 if (!target_name->IsString()) return prefix; 5220 if (!target_name->IsString()) return prefix;
5221 Factory* factory = isolate->factory(); 5221 Factory* factory = isolate->factory();
5222 return factory->NewConsString(prefix, Handle<String>::cast(target_name)); 5222 return factory->NewConsString(prefix, Handle<String>::cast(target_name));
5223 } 5223 }
5224 5224
5225 // static 5225 // static
5226 Handle<Object> JSFunction::GetPrototype(Isolate* isolate,
5227 Handle<JSFunction> function) {
5228 DCHECK(function->IsConstructor() || function->shared()->is_generator());
5229 if (!function->has_prototype()) {
5230 Handle<Object> proto = isolate->factory()->NewFunctionPrototype(function);
5231 JSFunction::SetPrototype(function, proto);
5232 }
5233 return handle(function->prototype(), isolate);
5234 }
5235
5236 // static
5226 Handle<Object> JSFunction::GetName(Isolate* isolate, 5237 Handle<Object> JSFunction::GetName(Isolate* isolate,
5227 Handle<JSFunction> function) { 5238 Handle<JSFunction> function) {
5228 if (function->shared()->name_should_print_as_anonymous()) { 5239 if (function->shared()->name_should_print_as_anonymous()) {
5229 return isolate->factory()->anonymous_string(); 5240 return isolate->factory()->anonymous_string();
5230 } 5241 }
5231 return handle(function->shared()->name(), isolate); 5242 return handle(function->shared()->name(), isolate);
5232 } 5243 }
5233 5244
5234 // static 5245 // static
5235 MaybeHandle<Smi> JSFunction::GetLength(Isolate* isolate, 5246 MaybeHandle<Smi> JSFunction::GetLength(Isolate* isolate,
(...skipping 13639 matching lines...) Expand 10 before | Expand all | Expand 10 after
18875 } else { 18886 } else {
18876 // Old-style generators. 18887 // Old-style generators.
18877 int offset = continuation(); 18888 int offset = continuation();
18878 CHECK(0 <= offset && offset < function()->code()->instruction_size()); 18889 CHECK(0 <= offset && offset < function()->code()->instruction_size());
18879 return function()->code()->SourcePosition(offset); 18890 return function()->code()->SourcePosition(offset);
18880 } 18891 }
18881 } 18892 }
18882 18893
18883 } // namespace internal 18894 } // namespace internal
18884 } // namespace v8 18895 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698