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

Unified Diff: test/cctest/test-compiler.cc

Issue 1423723002: Map v8::Function to JSReceiver + IsCallable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 2 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 | « test/cctest/test-api.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-compiler.cc
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index 1fac0d3746748ec4e15bbad158a5a1cf7569d98a..e15aef74a0cfa0dda5ca6929d8106bb25157a5a4 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -298,10 +298,8 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) {
"fun1 = fun;"
"function f(a) { a(); } f(fun1);");
- Handle<JSFunction> f =
- v8::Utils::OpenHandle(
- *v8::Handle<v8::Function>::Cast(
- CcTest::global()->Get(v8_str("f"))));
+ Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))));
// We shouldn't have deoptimization support. We want to recompile and
// verify that our feedback vector preserves information.
@@ -344,10 +342,9 @@ TEST(FeedbackVectorUnaffectedByScopeChanges) {
"}"
"morphing_call = builder();");
- Handle<JSFunction> f =
- v8::Utils::OpenHandle(
- *v8::Handle<v8::Function>::Cast(
- CcTest::global()->Get(v8_str("morphing_call"))));
+ Handle<JSFunction> f = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Function>::Cast(
+ CcTest::global()->Get(v8_str("morphing_call")))));
// Not compiled, and so no feedback vector allocated yet.
CHECK(!f->shared()->is_compiled());
@@ -382,10 +379,12 @@ TEST(OptimizedCodeSharing1) {
"%DebugPrint(closure0());"
"var closure1 = MakeClosure();"
"var closure2 = MakeClosure();");
- Handle<JSFunction> fun1 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1"))));
- Handle<JSFunction> fun2 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2"))));
+ Handle<JSFunction> fun1 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure1")))));
+ Handle<JSFunction> fun2 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure2")))));
CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
CHECK_EQ(fun1->code(), fun2->code());
@@ -419,8 +418,9 @@ TEST(OptimizedCodeSharing2) {
"%DebugPrint(closure0());"
"%OptimizeFunctionOnNextCall(closure0);"
"%DebugPrint(closure0());");
- Handle<JSFunction> fun0 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure0"))));
+ Handle<JSFunction> fun0 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure0")))));
CHECK(fun0->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
reference_code = handle(fun0->code());
}
@@ -436,10 +436,12 @@ TEST(OptimizedCodeSharing2) {
"%DebugPrint(closure0());"
"var closure1 = MakeClosure();"
"var closure2 = MakeClosure();");
- Handle<JSFunction> fun1 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1"))));
- Handle<JSFunction> fun2 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2"))));
+ Handle<JSFunction> fun1 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure1")))));
+ Handle<JSFunction> fun2 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure2")))));
CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
CHECK_EQ(*reference_code, fun1->code());
@@ -474,8 +476,9 @@ TEST(OptimizedCodeSharing3) {
"%DebugPrint(closure0());"
"%OptimizeFunctionOnNextCall(closure0);"
"%DebugPrint(closure0());");
- Handle<JSFunction> fun0 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure0"))));
+ Handle<JSFunction> fun0 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure0")))));
CHECK(fun0->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
reference_code = handle(fun0->code());
// Evict only the context-dependent entry from the optimized code map. This
@@ -494,10 +497,12 @@ TEST(OptimizedCodeSharing3) {
"%DebugPrint(closure0());"
"var closure1 = MakeClosure();"
"var closure2 = MakeClosure();");
- Handle<JSFunction> fun1 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1"))));
- Handle<JSFunction> fun2 = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2"))));
+ Handle<JSFunction> fun1 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure1")))));
+ Handle<JSFunction> fun2 = Handle<JSFunction>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8_str("closure2")))));
CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
CHECK_EQ(*reference_code, fun1->code());
@@ -644,10 +649,10 @@ TEST(CompileFunctionInContextScriptOrigin) {
#ifdef ENABLE_DISASSEMBLER
static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj,
- const char* property_name) {
+ const char* property_name) {
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name)));
- return v8::Utils::OpenHandle(*fun);
+ return Handle<JSFunction>::cast(v8::Utils::OpenHandle(*fun));
}
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698