OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 using v8::internal::TickSample; | 56 using v8::internal::TickSample; |
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, void* addr) { |
67 Address addr) { | |
68 v8::Local<v8::Value> func = context->Global()->Get(v8_str(func_name)); | 67 v8::Local<v8::Value> func = context->Global()->Get(v8_str(func_name)); |
69 CHECK(func->IsFunction()); | 68 CHECK(func->IsFunction()); |
70 JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func)); | 69 JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func)); |
71 return IsAddressWithinFuncCode(js_func, addr); | 70 return IsAddressWithinFuncCode(js_func, static_cast<Address>(addr)); |
72 } | 71 } |
73 | 72 |
74 | 73 |
75 // This C++ function is called as a constructor, to grab the frame pointer | 74 // 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 | 75 // 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. | 76 // 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) { | 77 static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { |
79 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); | 78 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); |
80 i::StackFrameIterator frame_iterator(isolate); | 79 i::StackFrameIterator frame_iterator(isolate); |
81 CHECK(frame_iterator.frame()->is_exit()); | 80 CHECK(frame_iterator.frame()->is_exit()); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 v8::Local<v8::Context> context = CcTest::NewContext(TRACE_EXTENSION); | 276 v8::Local<v8::Context> context = CcTest::NewContext(TRACE_EXTENSION); |
278 v8::Context::Scope context_scope(context); | 277 v8::Context::Scope context_scope(context); |
279 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); | 278 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); |
280 CompileRun("a = 1; b = a + 1;"); | 279 CompileRun("a = 1; b = a + 1;"); |
281 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); | 280 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); |
282 CompileRun("js_entry_sp();"); | 281 CompileRun("js_entry_sp();"); |
283 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); | 282 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); |
284 CompileRun("js_entry_sp_level2();"); | 283 CompileRun("js_entry_sp_level2();"); |
285 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); | 284 CHECK_EQ(0, i::TraceExtension::GetJsEntrySp()); |
286 } | 285 } |
OLD | NEW |