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

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

Issue 10543141: Enable lazy compilation for non-trivial outer contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Ulan Degenbaev. Created 8 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/scopes.cc ('k') | test/cctest/test-heap.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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); 190 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun);
191 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); 191 Handle<v8::internal::SharedFunctionInfo> shared(f->shared());
192 return Debug::HasDebugInfo(shared); 192 return Debug::HasDebugInfo(shared);
193 } 193 }
194 194
195 195
196 // Set a break point in a function and return the associated break point 196 // Set a break point in a function and return the associated break point
197 // number. 197 // number.
198 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { 198 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) {
199 static int break_point = 0; 199 static int break_point = 0;
200 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared());
201 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); 200 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug();
202 debug->SetBreakPoint( 201 debug->SetBreakPoint(
203 shared, 202 fun,
204 Handle<Object>(v8::internal::Smi::FromInt(++break_point)), 203 Handle<Object>(v8::internal::Smi::FromInt(++break_point)),
205 &position); 204 &position);
206 return break_point; 205 return break_point;
207 } 206 }
208 207
209 208
210 // Set a break point in a function and return the associated break point 209 // Set a break point in a function and return the associated break point
211 // number. 210 // number.
212 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) { 211 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) {
213 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); 212 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position);
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 CHECK_EQ(debug_break, 507 CHECK_EQ(debug_break,
509 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); 508 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address()));
510 } else { 509 } else {
511 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); 510 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo()));
512 } 511 }
513 512
514 // Clear the break point and check that the debug break function is no longer 513 // Clear the break point and check that the debug break function is no longer
515 // there 514 // there
516 ClearBreakPoint(bp); 515 ClearBreakPoint(bp);
517 CHECK(!debug->HasDebugInfo(shared)); 516 CHECK(!debug->HasDebugInfo(shared));
518 CHECK(debug->EnsureDebugInfo(shared)); 517 CHECK(debug->EnsureDebugInfo(shared, fun));
519 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); 518 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared));
520 it2.FindBreakLocationFromPosition(position); 519 it2.FindBreakLocationFromPosition(position);
521 actual_mode = it2.it()->rinfo()->rmode(); 520 actual_mode = it2.it()->rinfo()->rmode();
522 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { 521 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) {
523 actual_mode = v8::internal::RelocInfo::CODE_TARGET; 522 actual_mode = v8::internal::RelocInfo::CODE_TARGET;
524 } 523 }
525 CHECK_EQ(mode, actual_mode); 524 CHECK_EQ(mode, actual_mode);
526 if (mode == v8::internal::RelocInfo::JS_RETURN) { 525 if (mode == v8::internal::RelocInfo::JS_RETURN) {
527 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); 526 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo()));
528 } 527 }
(...skipping 6815 matching lines...) Expand 10 before | Expand all | Expand 10 after
7344 "g(false); \n" 7343 "g(false); \n"
7345 "%OptimizeFunctionOnNextCall(g); \n" 7344 "%OptimizeFunctionOnNextCall(g); \n"
7346 "g(true);"; 7345 "g(true);";
7347 v8::Debug::SetDebugEventListener(DebugBreakInlineListener); 7346 v8::Debug::SetDebugEventListener(DebugBreakInlineListener);
7348 inline_script = v8::Script::Compile(v8::String::New(source)); 7347 inline_script = v8::Script::Compile(v8::String::New(source));
7349 inline_script->Run(); 7348 inline_script->Run();
7350 } 7349 }
7351 7350
7352 7351
7353 #endif // ENABLE_DEBUGGER_SUPPORT 7352 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698