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

Side by Side Diff: test/cctest/test-log-stack-tracer.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the Sample class into an iterable. Created 6 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 58
59 static bool IsAddressWithinFuncCode(JSFunction* function, Address addr) { 59 static bool IsAddressWithinFuncCode(JSFunction* function, Address addr) {
60 i::Code* code = function->code(); 60 i::Code* code = function->code();
61 return code->contains(addr); 61 return code->contains(addr);
62 } 62 }
63 63
64 64
65 static bool IsAddressWithinFuncCode(v8::Local<v8::Context> context, 65 static bool IsAddressWithinFuncCode(v8::Local<v8::Context> context,
66 const char* func_name, 66 const char* func_name,
67 Address addr) { 67 void* addr) {
68 v8::Local<v8::Value> func = context->Global()->Get(v8_str(func_name)); 68 v8::Local<v8::Value> func = context->Global()->Get(v8_str(func_name));
69 CHECK(func->IsFunction()); 69 CHECK(func->IsFunction());
70 JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func)); 70 JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func));
71 return IsAddressWithinFuncCode(js_func, addr); 71 return IsAddressWithinFuncCode(js_func, static_cast<Address>(addr));
72 } 72 }
73 73
74 74
75 // This C++ function is called as a constructor, to grab the frame pointer 75 // This C++ function is called as a constructor, to grab the frame pointer
76 // from the calling function. When this function runs, the stack contains 76 // from the calling function. When this function runs, the stack contains
77 // a C_Entry frame and a Construct frame above the calling function's frame. 77 // a C_Entry frame and a Construct frame above the calling function's frame.
78 static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { 78 static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) {
79 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); 79 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
80 i::StackFrameIterator frame_iterator(isolate); 80 i::StackFrameIterator frame_iterator(isolate);
81 CHECK(frame_iterator.frame()->is_exit()); 81 CHECK(frame_iterator.frame()->is_exit());
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 v8::Local<v8::Context> context = CcTest::NewContext(TRACE_EXTENSION); 277 v8::Local<v8::Context> context = CcTest::NewContext(TRACE_EXTENSION);
278 v8::Context::Scope context_scope(context); 278 v8::Context::Scope context_scope(context);
279 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); 279 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
280 CompileRun("a = 1; b = a + 1;"); 280 CompileRun("a = 1; b = a + 1;");
281 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); 281 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
282 CompileRun("js_entry_sp();"); 282 CompileRun("js_entry_sp();");
283 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); 283 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
284 CompileRun("js_entry_sp_level2();"); 284 CompileRun("js_entry_sp_level2();");
285 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); 285 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
286 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698