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