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

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

Issue 3417006: Bring r5483 "Fix direct loading of global function prototypes" to 2.2. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.2/
Patch Set: Created 10 years, 3 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 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 11166 matching lines...) Expand 10 before | Expand all | Expand 10 after
11177 11177
11178 ExpectString("str2.substring(2, 10);", "elspenda"); 11178 ExpectString("str2.substring(2, 10);", "elspenda");
11179 11179
11180 ExpectString("str2.substring(2, 20);", "elspendabelabelspe"); 11180 ExpectString("str2.substring(2, 20);", "elspendabelabelspe");
11181 11181
11182 ExpectString("str2.charAt(2);", "e"); 11182 ExpectString("str2.charAt(2);", "e");
11183 11183
11184 reresult = CompileRun("str2.charCodeAt(2);"); 11184 reresult = CompileRun("str2.charCodeAt(2);");
11185 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); 11185 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value());
11186 } 11186 }
11187
11188
11189 TEST(StringCheckMultipleContexts) {
11190 const char* code =
11191 "(function() { return \"a\".charAt(0); })()";
11192
11193 {
11194 // Run the code twice in the first context to initialize the call IC.
11195 v8::HandleScope scope;
11196 LocalContext context1;
11197 ExpectString(code, "a");
11198 ExpectString(code, "a");
11199 }
11200
11201 {
11202 // Change the String.prototype in the second context and check
11203 // that the right function gets called.
11204 v8::HandleScope scope;
11205 LocalContext context2;
11206 CompileRun("String.prototype.charAt = function() { return \"not a\"; }");
11207 ExpectString(code, "not a");
11208 }
11209 }
11210
11211
11212 TEST(NumberCheckMultipleContexts) {
11213 const char* code =
11214 "(function() { return (42).toString(); })()";
11215
11216 {
11217 // Run the code twice in the first context to initialize the call IC.
11218 v8::HandleScope scope;
11219 LocalContext context1;
11220 ExpectString(code, "42");
11221 ExpectString(code, "42");
11222 }
11223
11224 {
11225 // Change the Number.prototype in the second context and check
11226 // that the right function gets called.
11227 v8::HandleScope scope;
11228 LocalContext context2;
11229 CompileRun("Number.prototype.toString = function() { return \"not 42\"; }");
11230 ExpectString(code, "not 42");
11231 }
11232 }
11233
11234
11235 TEST(BooleanCheckMultipleContexts) {
11236 const char* code =
11237 "(function() { return true.toString(); })()";
11238
11239 {
11240 // Run the code twice in the first context to initialize the call IC.
11241 v8::HandleScope scope;
11242 LocalContext context1;
11243 ExpectString(code, "true");
11244 ExpectString(code, "true");
11245 }
11246
11247 {
11248 // Change the Boolean.prototype in the second context and check
11249 // that the right function gets called.
11250 v8::HandleScope scope;
11251 LocalContext context2;
11252 CompileRun("Boolean.prototype.toString = function() { return \"\"; }");
11253 ExpectString(code, "");
11254 }
11255 }
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