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

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

Issue 1917006: Inlined load of string.length and array.length.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 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/ic.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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 foo->Call(env->Global(), kArgc, args); 2504 foo->Call(env->Global(), kArgc, args);
2505 2505
2506 // With stepping all break locations are hit. 2506 // With stepping all break locations are hit.
2507 CHECK_EQ(22, break_point_hit_count); 2507 CHECK_EQ(22, break_point_hit_count);
2508 2508
2509 v8::Debug::SetDebugEventListener(NULL); 2509 v8::Debug::SetDebugEventListener(NULL);
2510 CheckDebuggerUnloaded(); 2510 CheckDebuggerUnloaded();
2511 } 2511 }
2512 2512
2513 2513
2514 // Test of the stepping mechanism for named load in a loop.
2515 TEST(DebugStepNamedLoadLoop) {
2516 v8::HandleScope scope;
2517 DebugLocalContext env;
2518
2519 // Create a function for testing stepping of named load.
2520 v8::Local<v8::Function> foo = CompileFunction(
2521 &env,
2522 "function foo() {\n"
2523 " var a = [];\n"
2524 " var s = \"\";\n"
2525 " for (var i = 0; i < 10; i++) {\n"
2526 " var v = new V(i, i + 1);\n"
2527 " v.y;\n"
2528 " a.length;\n" // Special case: array length.
2529 " s.length;\n" // Special case: string length.
2530 " }\n"
2531 "}\n"
2532 "function V(x, y) {\n"
2533 " this.x = x;\n"
2534 " this.y = y;\n"
2535 "}\n",
2536 "foo");
2537
2538 // Call function without any break points to ensure inlining is in place.
2539 foo->Call(env->Global(), 0, NULL);
2540
2541 // Register a debug event listener which steps and counts.
2542 v8::Debug::SetDebugEventListener(DebugEventStep);
2543
2544 // Setup break point and step through the function.
2545 SetBreakPoint(foo, 4);
2546 step_action = StepNext;
2547 break_point_hit_count = 0;
2548 foo->Call(env->Global(), 0, NULL);
2549
2550 // With stepping all break locations are hit.
2551 CHECK_EQ(41, break_point_hit_count);
2552
2553 v8::Debug::SetDebugEventListener(NULL);
2554 CheckDebuggerUnloaded();
2555 }
2556
2557
2514 // Test the stepping mechanism with different ICs. 2558 // Test the stepping mechanism with different ICs.
2515 TEST(DebugStepLinearMixedICs) { 2559 TEST(DebugStepLinearMixedICs) {
2516 v8::HandleScope scope; 2560 v8::HandleScope scope;
2517 DebugLocalContext env; 2561 DebugLocalContext env;
2518 2562
2519 // Create a function for testing stepping. 2563 // Create a function for testing stepping.
2520 v8::Local<v8::Function> foo = CompileFunction(&env, 2564 v8::Local<v8::Function> foo = CompileFunction(&env,
2521 "function bar() {};" 2565 "function bar() {};"
2522 "function foo() {" 2566 "function foo() {"
2523 " var x;" 2567 " var x;"
(...skipping 3625 matching lines...) Expand 10 before | Expand all | Expand 10 after
6149 6193
6150 TEST(DebugContextIsPreservedBetweenAccesses) { 6194 TEST(DebugContextIsPreservedBetweenAccesses) {
6151 v8::HandleScope scope; 6195 v8::HandleScope scope;
6152 v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext(); 6196 v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext();
6153 v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext(); 6197 v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext();
6154 CHECK_EQ(*context1, *context2); 6198 CHECK_EQ(*context1, *context2);
6155 // Make sure debugger is unloaded before running other tests. 6199 // Make sure debugger is unloaded before running other tests.
6156 v8::internal::ForceUnloadDebugger(); 6200 v8::internal::ForceUnloadDebugger();
6157 CheckDebuggerUnloaded(); 6201 CheckDebuggerUnloaded();
6158 } 6202 }
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698