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

Side by Side Diff: src/api.cc

Issue 2505853003: Refactor SharedFunctionInfo::IsBuiltin. (Closed)
Patch Set: rebase Created 4 years, 1 month 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/accessors.cc ('k') | src/ast/prettyprinter.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5111 return kLineOffsetNotFound; 5111 return kLineOffsetNotFound;
5112 } 5112 }
5113 5113
5114 5114
5115 bool Function::IsBuiltin() const { 5115 bool Function::IsBuiltin() const {
5116 auto self = Utils::OpenHandle(this); 5116 auto self = Utils::OpenHandle(this);
5117 if (!self->IsJSFunction()) { 5117 if (!self->IsJSFunction()) {
5118 return false; 5118 return false;
5119 } 5119 }
5120 auto func = i::Handle<i::JSFunction>::cast(self); 5120 auto func = i::Handle<i::JSFunction>::cast(self);
5121 return func->shared()->IsBuiltin(); 5121 return !func->shared()->IsUserJavaScript();
5122 } 5122 }
5123 5123
5124 5124
5125 int Function::ScriptId() const { 5125 int Function::ScriptId() const {
5126 auto self = Utils::OpenHandle(this); 5126 auto self = Utils::OpenHandle(this);
5127 if (!self->IsJSFunction()) { 5127 if (!self->IsJSFunction()) {
5128 return v8::UnboundScript::kNoScriptId; 5128 return v8::UnboundScript::kNoScriptId;
5129 } 5129 }
5130 auto func = i::Handle<i::JSFunction>::cast(self); 5130 auto func = i::Handle<i::JSFunction>::cast(self);
5131 if (!func->shared()->script()->IsScript()) { 5131 if (!func->shared()->script()->IsScript()) {
(...skipping 4723 matching lines...) Expand 10 before | Expand all | Expand 10 after
9855 Address callback_address = 9855 Address callback_address =
9856 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9856 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9857 VMState<EXTERNAL> state(isolate); 9857 VMState<EXTERNAL> state(isolate);
9858 ExternalCallbackScope call_scope(isolate, callback_address); 9858 ExternalCallbackScope call_scope(isolate, callback_address);
9859 callback(info); 9859 callback(info);
9860 } 9860 }
9861 9861
9862 9862
9863 } // namespace internal 9863 } // namespace internal
9864 } // namespace v8 9864 } // namespace v8
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/ast/prettyprinter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698