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

Side by Side Diff: test/cctest/test-api.cc

Issue 315003003: Compilation API: next step of deprecations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-cpu-profiler.cc » ('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 // 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 17527 matching lines...) Expand 10 before | Expand all | Expand 10 after
17538 v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8( 17538 v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8(
17539 isolate, 17539 isolate,
17540 "function foo() {\n" 17540 "function foo() {\n"
17541 " AnalyzeScriptIdInStack();" 17541 " AnalyzeScriptIdInStack();"
17542 "}\n" 17542 "}\n"
17543 "foo();\n"); 17543 "foo();\n");
17544 v8::Local<v8::Script> script = CompileWithOrigin(scriptSource, "test"); 17544 v8::Local<v8::Script> script = CompileWithOrigin(scriptSource, "test");
17545 script->Run(); 17545 script->Run();
17546 for (int i = 0; i < 2; i++) { 17546 for (int i = 0; i < 2; i++) {
17547 CHECK(scriptIdInStack[i] != v8::Message::kNoScriptIdInfo); 17547 CHECK(scriptIdInStack[i] != v8::Message::kNoScriptIdInfo);
17548 CHECK_EQ(scriptIdInStack[i], script->GetId()); 17548 CHECK_EQ(scriptIdInStack[i], script->GetUnboundScript()->GetId());
17549 } 17549 }
17550 } 17550 }
17551 17551
17552 17552
17553 void AnalyzeStackOfInlineScriptWithSourceURL( 17553 void AnalyzeStackOfInlineScriptWithSourceURL(
17554 const v8::FunctionCallbackInfo<v8::Value>& args) { 17554 const v8::FunctionCallbackInfo<v8::Value>& args) {
17555 v8::HandleScope scope(args.GetIsolate()); 17555 v8::HandleScope scope(args.GetIsolate());
17556 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( 17556 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
17557 args.GetIsolate(), 10, v8::StackTrace::kDetailed); 17557 args.GetIsolate(), 10, v8::StackTrace::kDetailed);
17558 CHECK_EQ(4, stackTrace->GetFrameCount()); 17558 CHECK_EQ(4, stackTrace->GetFrameCount());
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
18469 v8::Integer::New(isolate, 3), 18469 v8::Integer::New(isolate, 3),
18470 v8::Integer::New(isolate, 2)); 18470 v8::Integer::New(isolate, 2));
18471 v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8( 18471 v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8(
18472 isolate, "function foo() {}\n\n function bar() {}"); 18472 isolate, "function foo() {}\n\n function bar() {}");
18473 v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin)); 18473 v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin));
18474 script->Run(); 18474 script->Run();
18475 v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( 18475 v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
18476 env->Global()->Get(v8::String::NewFromUtf8(isolate, "foo"))); 18476 env->Global()->Get(v8::String::NewFromUtf8(isolate, "foo")));
18477 v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast( 18477 v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast(
18478 env->Global()->Get(v8::String::NewFromUtf8(isolate, "bar"))); 18478 env->Global()->Get(v8::String::NewFromUtf8(isolate, "bar")));
18479 CHECK_EQ(script->GetId(), foo->ScriptId()); 18479 CHECK_EQ(script->GetUnboundScript()->GetId(), foo->ScriptId());
18480 CHECK_EQ(script->GetId(), bar->ScriptId()); 18480 CHECK_EQ(script->GetUnboundScript()->GetId(), bar->ScriptId());
18481 } 18481 }
18482 18482
18483 18483
18484 THREADED_TEST(FunctionGetBoundFunction) { 18484 THREADED_TEST(FunctionGetBoundFunction) {
18485 LocalContext env; 18485 LocalContext env;
18486 v8::HandleScope scope(env->GetIsolate()); 18486 v8::HandleScope scope(env->GetIsolate());
18487 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::NewFromUtf8( 18487 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::NewFromUtf8(
18488 env->GetIsolate(), "test")); 18488 env->GetIsolate(), "test"));
18489 v8::Handle<v8::String> script = v8::String::NewFromUtf8( 18489 v8::Handle<v8::String> script = v8::String::NewFromUtf8(
18490 env->GetIsolate(), 18490 env->GetIsolate(),
(...skipping 4181 matching lines...) Expand 10 before | Expand all | Expand 10 after
22672 Local<Script> script = v8::ScriptCompiler::Compile( 22672 Local<Script> script = v8::ScriptCompiler::Compile(
22673 isolate, &script_source); 22673 isolate, &script_source);
22674 Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); 22674 Local<Value> script_name = script->GetUnboundScript()->GetScriptName();
22675 CHECK(!script_name.IsEmpty()); 22675 CHECK(!script_name.IsEmpty());
22676 CHECK(script_name->IsString()); 22676 CHECK(script_name->IsString());
22677 String::Utf8Value utf8_name(script_name); 22677 String::Utf8Value utf8_name(script_name);
22678 CHECK_EQ(url, *utf8_name); 22678 CHECK_EQ(url, *utf8_name);
22679 int line_number = script->GetUnboundScript()->GetLineNumber(0); 22679 int line_number = script->GetUnboundScript()->GetLineNumber(0);
22680 CHECK_EQ(13, line_number); 22680 CHECK_EQ(13, line_number);
22681 } 22681 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698