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

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

Issue 546088: Fix issue 582: preserve construct stub on first allocation in case we can't optimize it. (Closed)
Patch Set: Created 10 years, 11 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/runtime.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 CHECK_EQ(v8::Integer::New(6), Script::Compile(v8_str("Foo(2)"))->Run()); 2832 CHECK_EQ(v8::Integer::New(6), Script::Compile(v8_str("Foo(2)"))->Run());
2833 } 2833 }
2834 2834
2835 2835
2836 THREADED_TEST(NativeFunctionConstructCall) { 2836 THREADED_TEST(NativeFunctionConstructCall) {
2837 v8::RegisterExtension(new FunctionExtension()); 2837 v8::RegisterExtension(new FunctionExtension());
2838 v8::HandleScope handle_scope; 2838 v8::HandleScope handle_scope;
2839 static const char* exts[1] = { "functiontest" }; 2839 static const char* exts[1] = { "functiontest" };
2840 v8::ExtensionConfiguration config(1, exts); 2840 v8::ExtensionConfiguration config(1, exts);
2841 LocalContext context(&config); 2841 LocalContext context(&config);
2842 CHECK_EQ(v8::Integer::New(8), 2842 for (int i = 0; i < 10; i++) {
2843 Script::Compile(v8_str("(new A()).data"))->Run()); 2843 // Run a few times to ensure that allocation of objects doesn't
2844 CHECK_EQ(v8::Integer::New(7), 2844 // change behavior of a constructor function.
2845 Script::Compile(v8_str("(new B()).data"))->Run()); 2845 CHECK_EQ(v8::Integer::New(8),
2846 CHECK_EQ(v8::Integer::New(6), 2846 Script::Compile(v8_str("(new A()).data"))->Run());
2847 Script::Compile(v8_str("(new C()).data"))->Run()); 2847 CHECK_EQ(v8::Integer::New(7),
2848 Script::Compile(v8_str("(new B()).data"))->Run());
2849 CHECK_EQ(v8::Integer::New(6),
2850 Script::Compile(v8_str("(new C()).data"))->Run());
2851 }
2848 } 2852 }
2849 2853
2850 2854
2851 static const char* last_location; 2855 static const char* last_location;
2852 static const char* last_message; 2856 static const char* last_message;
2853 void StoringErrorCallback(const char* location, const char* message) { 2857 void StoringErrorCallback(const char* location, const char* message) {
2854 if (last_location == NULL) { 2858 if (last_location == NULL) {
2855 last_location = location; 2859 last_location = location;
2856 last_message = message; 2860 last_message = message;
2857 } 2861 }
(...skipping 5820 matching lines...) Expand 10 before | Expand all | Expand 10 after
8678 CompileRun(source_exception); 8682 CompileRun(source_exception);
8679 other_context->Exit(); 8683 other_context->Exit();
8680 v8::internal::Heap::CollectAllGarbage(false); 8684 v8::internal::Heap::CollectAllGarbage(false);
8681 if (GetGlobalObjectsCount() == 1) break; 8685 if (GetGlobalObjectsCount() == 1) break;
8682 } 8686 }
8683 CHECK_GE(2, gc_count); 8687 CHECK_GE(2, gc_count);
8684 CHECK_EQ(1, GetGlobalObjectsCount()); 8688 CHECK_EQ(1, GetGlobalObjectsCount());
8685 8689
8686 other_context.Dispose(); 8690 other_context.Dispose();
8687 } 8691 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698