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

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: 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
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index a138e39f293e1610868415e4519559a2d0e426b6..e68c580d6d6a99f72b549ab3a6cab0b67bd9e57e 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);
@@ -4326,6 +4339,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())
@@ -4334,6 +4348,16 @@ 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 i::Script::kNoScriptId;
yurys 2013/06/25 11:57:38 This should be a public constant.
Jakob Kummerow 2013/06/25 11:58:39 nit: {} please
loislo 2013/06/25 13:04:53 Done.
loislo 2013/06/25 13:04:53 Done.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698