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