OLD | NEW |
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 3956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3967 } | 3967 } |
3968 | 3968 |
3969 | 3969 |
3970 bool message_received; | 3970 bool message_received; |
3971 | 3971 |
3972 | 3972 |
3973 static void check_message_0(v8::Handle<v8::Message> message, | 3973 static void check_message_0(v8::Handle<v8::Message> message, |
3974 v8::Handle<Value> data) { | 3974 v8::Handle<Value> data) { |
3975 CHECK_EQ(5.76, data->NumberValue()); | 3975 CHECK_EQ(5.76, data->NumberValue()); |
3976 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); | 3976 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); |
3977 CHECK_EQ(7.56, message->GetScriptData()->NumberValue()); | |
3978 CHECK(!message->IsSharedCrossOrigin()); | 3977 CHECK(!message->IsSharedCrossOrigin()); |
3979 message_received = true; | 3978 message_received = true; |
3980 } | 3979 } |
3981 | 3980 |
3982 | 3981 |
3983 THREADED_TEST(MessageHandler0) { | 3982 THREADED_TEST(MessageHandler0) { |
3984 message_received = false; | 3983 message_received = false; |
3985 v8::HandleScope scope(CcTest::isolate()); | 3984 v8::HandleScope scope(CcTest::isolate()); |
3986 CHECK(!message_received); | 3985 CHECK(!message_received); |
3987 LocalContext context; | 3986 LocalContext context; |
3988 v8::V8::AddMessageListener(check_message_0, v8_num(5.76)); | 3987 v8::V8::AddMessageListener(check_message_0, v8_num(5.76)); |
3989 v8::ScriptOrigin origin = | 3988 v8::ScriptOrigin origin = |
3990 v8::ScriptOrigin(v8_str("6.75")); | 3989 v8::ScriptOrigin(v8_str("6.75")); |
3991 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), | 3990 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), |
3992 &origin); | 3991 &origin); |
3993 script->SetData(v8_str("7.56")); | |
3994 script->Run(); | 3992 script->Run(); |
3995 CHECK(message_received); | 3993 CHECK(message_received); |
3996 // clear out the message listener | 3994 // clear out the message listener |
3997 v8::V8::RemoveMessageListeners(check_message_0); | 3995 v8::V8::RemoveMessageListeners(check_message_0); |
3998 } | 3996 } |
3999 | 3997 |
4000 | 3998 |
4001 static void check_message_1(v8::Handle<v8::Message> message, | 3999 static void check_message_1(v8::Handle<v8::Message> message, |
4002 v8::Handle<Value> data) { | 4000 v8::Handle<Value> data) { |
4003 CHECK(data->IsNumber()); | 4001 CHECK(data->IsNumber()); |
(...skipping 18105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22109 Local<Object> ApiCallOptimizationChecker::holder; | 22107 Local<Object> ApiCallOptimizationChecker::holder; |
22110 Local<Object> ApiCallOptimizationChecker::callee; | 22108 Local<Object> ApiCallOptimizationChecker::callee; |
22111 int ApiCallOptimizationChecker::count = 0; | 22109 int ApiCallOptimizationChecker::count = 0; |
22112 | 22110 |
22113 | 22111 |
22114 TEST(TestFunctionCallOptimization) { | 22112 TEST(TestFunctionCallOptimization) { |
22115 i::FLAG_allow_natives_syntax = true; | 22113 i::FLAG_allow_natives_syntax = true; |
22116 ApiCallOptimizationChecker checker; | 22114 ApiCallOptimizationChecker checker; |
22117 checker.RunAll(); | 22115 checker.RunAll(); |
22118 } | 22116 } |
OLD | NEW |