| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 using v8::Object; | 44 using v8::Object; |
| 45 using v8::Script; | 45 using v8::Script; |
| 46 using v8::String; | 46 using v8::String; |
| 47 using v8::Value; | 47 using v8::Value; |
| 48 | 48 |
| 49 using v8::internal::byte; | 49 using v8::internal::byte; |
| 50 using v8::internal::Address; | 50 using v8::internal::Address; |
| 51 using v8::internal::Handle; | 51 using v8::internal::Handle; |
| 52 using v8::internal::Isolate; | 52 using v8::internal::Isolate; |
| 53 using v8::internal::JSFunction; | 53 using v8::internal::JSFunction; |
| 54 using v8::internal::RegisterState; |
| 54 using v8::internal::TickSample; | 55 using v8::internal::TickSample; |
| 55 | 56 |
| 56 | 57 |
| 57 static struct { | 58 static struct { |
| 58 TickSample* sample; | 59 TickSample* sample; |
| 59 } trace_env = { NULL }; | 60 } trace_env = { NULL }; |
| 60 | 61 |
| 61 | 62 |
| 62 static void InitTraceEnv(TickSample* sample) { | 63 static void InitTraceEnv(TickSample* sample) { |
| 63 trace_env.sample = sample; | 64 trace_env.sample = sample; |
| 64 } | 65 } |
| 65 | 66 |
| 66 | 67 |
| 67 static void DoTrace(Address fp) { | 68 static void DoTrace(Address fp) { |
| 68 trace_env.sample->fp = fp; | 69 RegisterState regs; |
| 70 regs.fp = fp; |
| 69 // sp is only used to define stack high bound | 71 // sp is only used to define stack high bound |
| 70 trace_env.sample->sp = | 72 regs.sp = |
| 71 reinterpret_cast<Address>(trace_env.sample) - 10240; | 73 reinterpret_cast<Address>(trace_env.sample) - 10240; |
| 72 trace_env.sample->Trace(Isolate::Current()); | 74 trace_env.sample->Init(Isolate::Current(), regs); |
| 73 } | 75 } |
| 74 | 76 |
| 75 | 77 |
| 76 // Hide c_entry_fp to emulate situation when sampling is done while | 78 // Hide c_entry_fp to emulate situation when sampling is done while |
| 77 // pure JS code is being executed | 79 // pure JS code is being executed |
| 78 static void DoTraceHideCEntryFPAddress(Address fp) { | 80 static void DoTraceHideCEntryFPAddress(Address fp) { |
| 79 v8::internal::Address saved_c_frame_fp = | 81 v8::internal::Address saved_c_frame_fp = |
| 80 *(Isolate::Current()->c_entry_fp_address()); | 82 *(Isolate::Current()->c_entry_fp_address()); |
| 81 CHECK(saved_c_frame_fp); | 83 CHECK(saved_c_frame_fp); |
| 82 *(Isolate::Current()->c_entry_fp_address()) = 0; | 84 *(Isolate::Current()->c_entry_fp_address()) = 0; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 CcTest::InitializeVM(TRACE_EXTENSION); | 387 CcTest::InitializeVM(TRACE_EXTENSION); |
| 386 v8::HandleScope scope(CcTest::isolate()); | 388 v8::HandleScope scope(CcTest::isolate()); |
| 387 CHECK_EQ(0, GetJsEntrySp()); | 389 CHECK_EQ(0, GetJsEntrySp()); |
| 388 CompileRun("a = 1; b = a + 1;"); | 390 CompileRun("a = 1; b = a + 1;"); |
| 389 CHECK_EQ(0, GetJsEntrySp()); | 391 CHECK_EQ(0, GetJsEntrySp()); |
| 390 CompileRun("js_entry_sp();"); | 392 CompileRun("js_entry_sp();"); |
| 391 CHECK_EQ(0, GetJsEntrySp()); | 393 CHECK_EQ(0, GetJsEntrySp()); |
| 392 CompileRun("js_entry_sp_level2();"); | 394 CompileRun("js_entry_sp_level2();"); |
| 393 CHECK_EQ(0, GetJsEntrySp()); | 395 CHECK_EQ(0, GetJsEntrySp()); |
| 394 } | 396 } |
| OLD | NEW |