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

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

Issue 1058553004: [crankshaft] Add missing source position for calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « src/hydrogen.cc ('k') | test/cctest/test-debug.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 10143 matching lines...) Expand 10 before | Expand all | Expand 10 after
10154 v8::TryCatch try_catch; 10154 v8::TryCatch try_catch;
10155 Local<Value> value; 10155 Local<Value> value;
10156 CHECK(!try_catch.HasCaught()); 10156 CHECK(!try_catch.HasCaught());
10157 10157
10158 // Call an object without call-as-function handler through the JS 10158 // Call an object without call-as-function handler through the JS
10159 value = CompileRun("obj2(28)"); 10159 value = CompileRun("obj2(28)");
10160 CHECK(value.IsEmpty()); 10160 CHECK(value.IsEmpty());
10161 CHECK(try_catch.HasCaught()); 10161 CHECK(try_catch.HasCaught());
10162 String::Utf8Value exception_value1(try_catch.Exception()); 10162 String::Utf8Value exception_value1(try_catch.Exception());
10163 // TODO(verwaest): Better message 10163 // TODO(verwaest): Better message
10164 // TODO(3995): Our compilers disagree about the position (and message). 10164 CHECK_EQ(0, strcmp("TypeError: obj2 is not a function", *exception_value1));
10165 if (!i::FLAG_always_opt) {
10166 CHECK_EQ(0,
10167 strcmp("TypeError: obj2 is not a function", *exception_value1));
10168 }
10169 try_catch.Reset(); 10165 try_catch.Reset();
10170 10166
10171 // Call an object without call-as-function handler through the API 10167 // Call an object without call-as-function handler through the API
10172 value = CompileRun("obj2(28)"); 10168 value = CompileRun("obj2(28)");
10173 v8::Handle<Value> args[] = {v8_num(28)}; 10169 v8::Handle<Value> args[] = {v8_num(28)};
10174 value = instance->CallAsFunction(instance, 1, args); 10170 value = instance->CallAsFunction(instance, 1, args);
10175 CHECK(value.IsEmpty()); 10171 CHECK(value.IsEmpty());
10176 CHECK(try_catch.HasCaught()); 10172 CHECK(try_catch.HasCaught());
10177 String::Utf8Value exception_value2(try_catch.Exception()); 10173 String::Utf8Value exception_value2(try_catch.Exception());
10178 CHECK_EQ(0, strcmp("TypeError: [object Object] is not a function", 10174 CHECK_EQ(0, strcmp("TypeError: [object Object] is not a function",
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
10714 "var saved_result = 0;" 10710 "var saved_result = 0;"
10715 "for (var i = 0; i < 100; i++) {" 10711 "for (var i = 0; i < 100; i++) {"
10716 " result = receiver.method(41);" 10712 " result = receiver.method(41);"
10717 " if (i == 50) {" 10713 " if (i == 50) {"
10718 " saved_result = result;" 10714 " saved_result = result;"
10719 " receiver = 333;" 10715 " receiver = 333;"
10720 " }" 10716 " }"
10721 "}"); 10717 "}");
10722 CHECK(try_catch.HasCaught()); 10718 CHECK(try_catch.HasCaught());
10723 // TODO(verwaest): Adjust message. 10719 // TODO(verwaest): Adjust message.
10724 // TODO(3995): Our compilers disagree about the position (and message). 10720 CHECK(v8_str("TypeError: receiver.method is not a function")
10725 if (!i::FLAG_always_opt) { 10721 ->Equals(try_catch.Exception()->ToString(isolate)));
10726 CHECK(v8_str("TypeError: receiver.method is not a function")
10727 ->Equals(try_catch.Exception()->ToString(isolate)));
10728 }
10729 CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value()); 10722 CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
10730 CHECK_GE(interceptor_call_count, 50); 10723 CHECK_GE(interceptor_call_count, 50);
10731 } 10724 }
10732 10725
10733 10726
10734 THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) { 10727 THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
10735 int interceptor_call_count = 0; 10728 int interceptor_call_count = 0;
10736 v8::Isolate* isolate = CcTest::isolate(); 10729 v8::Isolate* isolate = CcTest::isolate();
10737 v8::HandleScope scope(isolate); 10730 v8::HandleScope scope(isolate);
10738 v8::Handle<v8::FunctionTemplate> fun_templ = 10731 v8::Handle<v8::FunctionTemplate> fun_templ =
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
10892 "var saved_result = 0;" 10885 "var saved_result = 0;"
10893 "for (var i = 0; i < 100; i++) {" 10886 "for (var i = 0; i < 100; i++) {"
10894 " result = receiver.method(41);" 10887 " result = receiver.method(41);"
10895 " if (i == 50) {" 10888 " if (i == 50) {"
10896 " saved_result = result;" 10889 " saved_result = result;"
10897 " receiver = 333;" 10890 " receiver = 333;"
10898 " }" 10891 " }"
10899 "}"); 10892 "}");
10900 CHECK(try_catch.HasCaught()); 10893 CHECK(try_catch.HasCaught());
10901 // TODO(verwaest): Adjust message. 10894 // TODO(verwaest): Adjust message.
10902 // TODO(3995): Our compilers disagree about the position (and message). 10895 CHECK(v8_str("TypeError: receiver.method is not a function")
10903 if (!i::FLAG_always_opt) { 10896 ->Equals(try_catch.Exception()->ToString(isolate)));
10904 CHECK(v8_str("TypeError: receiver.method is not a function")
10905 ->Equals(try_catch.Exception()->ToString(isolate)));
10906 }
10907 CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value()); 10897 CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
10908 } 10898 }
10909 10899
10910 10900
10911 THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) { 10901 THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
10912 v8::Isolate* isolate = CcTest::isolate(); 10902 v8::Isolate* isolate = CcTest::isolate();
10913 v8::HandleScope scope(isolate); 10903 v8::HandleScope scope(isolate);
10914 v8::Handle<v8::FunctionTemplate> fun_templ = 10904 v8::Handle<v8::FunctionTemplate> fun_templ =
10915 v8::FunctionTemplate::New(isolate); 10905 v8::FunctionTemplate::New(isolate);
10916 v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New( 10906 v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
(...skipping 10999 matching lines...) Expand 10 before | Expand all | Expand 10 after
21916 21906
21917 { 21907 {
21918 v8::HandleScope handle_scope(isolate); 21908 v8::HandleScope handle_scope(isolate);
21919 21909
21920 // Should work 21910 // Should work
21921 v8::Local<v8::Object> obj = v8::Object::New(isolate); 21911 v8::Local<v8::Object> obj = v8::Object::New(isolate);
21922 21912
21923 USE(obj); 21913 USE(obj);
21924 } 21914 }
21925 } 21915 }
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698