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

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

Issue 16642003: add a default value for return value (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 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 | « src/x64/stub-cache-x64.cc ('k') | no next file » | 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 } 803 }
804 804
805 805
806 template<typename T> 806 template<typename T>
807 static void CheckReturnValue(const T& t) { 807 static void CheckReturnValue(const T& t) {
808 v8::ReturnValue<v8::Value> rv = t.GetReturnValue(); 808 v8::ReturnValue<v8::Value> rv = t.GetReturnValue();
809 i::Object** o = *reinterpret_cast<i::Object***>(&rv); 809 i::Object** o = *reinterpret_cast<i::Object***>(&rv);
810 CHECK_EQ(v8::Isolate::GetCurrent(), t.GetIsolate()); 810 CHECK_EQ(v8::Isolate::GetCurrent(), t.GetIsolate());
811 CHECK_EQ(t.GetIsolate(), rv.GetIsolate()); 811 CHECK_EQ(t.GetIsolate(), rv.GetIsolate());
812 CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); 812 CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
813 // Verify reset
814 bool is_runtime = (*o)->IsTheHole();
815 rv.Set(true);
816 CHECK(!(*o)->IsTheHole() && !(*o)->IsUndefined());
817 rv.Set(v8::Handle<v8::Object>());
818 CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
819 CHECK_EQ(is_runtime, (*o)->IsTheHole());
813 } 820 }
814 821
815 static v8::Handle<Value> handle_call(const v8::Arguments& args) { 822 static v8::Handle<Value> handle_call(const v8::Arguments& args) {
816 ApiTestFuzzer::Fuzz(); 823 ApiTestFuzzer::Fuzz();
817 CheckReturnValue(args); 824 CheckReturnValue(args);
818 args.GetReturnValue().Set(v8_str("bad value")); 825 args.GetReturnValue().Set(v8_str("bad value"));
819 return v8_num(102); 826 return v8_num(102);
820 } 827 }
821 828
822 static v8::Handle<Value> handle_call_2(const v8::Arguments& args) { 829 static v8::Handle<Value> handle_call_2(const v8::Arguments& args) {
(...skipping 18499 matching lines...) Expand 10 before | Expand all | Expand 10 after
19322 i::Semaphore* sem_; 19329 i::Semaphore* sem_;
19323 volatile int sem_value_; 19330 volatile int sem_value_;
19324 }; 19331 };
19325 19332
19326 19333
19327 THREADED_TEST(SemaphoreInterruption) { 19334 THREADED_TEST(SemaphoreInterruption) {
19328 ThreadInterruptTest().RunTest(); 19335 ThreadInterruptTest().RunTest();
19329 } 19336 }
19330 19337
19331 #endif // WIN32 19338 #endif // WIN32
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698