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

Unified Diff: src/api.cc

Issue 17600006: CPUProfiler: It is not clear why we are using Handle<Object> for scriptId. Lets flip it into Smi/in… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 58041309b1a148b9796bf909967a32556518fb1c..8ca858dca91d367e5ba9bb849c8a22ec3f673a1d 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2026,6 +2026,19 @@ Local<Value> Script::Id() {
}
+int Script::GetId() {
+ i::Isolate* isolate = i::Isolate::Current();
+ ON_BAILOUT(isolate, "v8::Script::Id()", return -1);
+ LOG_API(isolate, "Script::Id");
+ {
+ i::HandleScope scope(isolate);
+ i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this);
+ i::Handle<i::Script> script(i::Script::cast(function_info->script()));
+ return script->id()->value();
+ }
+}
+
+
int Script::GetLineNumber(int code_pos) {
i::Isolate* isolate = i::Isolate::Current();
ON_BAILOUT(isolate, "v8::Script::GetLineNumber()", return -1);
@@ -4336,6 +4349,7 @@ int Function::GetScriptColumnNumber() const {
return kLineOffsetNotFound;
}
+
Handle<Value> Function::GetScriptId() const {
i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
if (!func->shared()->script()->IsScript())
@@ -4344,6 +4358,15 @@ Handle<Value> Function::GetScriptId() const {
return Utils::ToLocal(i::Handle<i::Object>(script->id(), func->GetIsolate()));
}
+
+int Function::ScriptId() const {
+ i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
+ if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId;
+ i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
+ return script->id()->value();
+}
+
+
int String::Length() const {
i::Handle<i::String> str = Utils::OpenHandle(this);
if (IsDeadCheck(str->GetIsolate(), "v8::String::Length()")) return 0;
« no previous file with comments | « include/v8.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698