Commit 411b7d18 authored by ager@chromium.org's avatar ager@chromium.org

Fix lint issues found by tools/presubmit.py.

TBR=mikhail.naganov
Review URL: http://codereview.chromium.org/28178

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1371 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c093e945
...@@ -275,8 +275,8 @@ class Logger { ...@@ -275,8 +275,8 @@ class Logger {
// Class that extracts stack trace, used for profiling // Class that extracts stack trace, used for profiling
class StackTracer BASE_EMBEDDED { class StackTracer BASE_EMBEDDED {
public: public:
StackTracer(unsigned int low_stack_bound): low_stack_bound_(low_stack_bound) { explicit StackTracer(unsigned int low_stack_bound)
} : low_stack_bound_(low_stack_bound) { }
void Trace(TickSample* sample); void Trace(TickSample* sample);
private: private:
unsigned int low_stack_bound_; unsigned int low_stack_bound_;
......
...@@ -51,7 +51,7 @@ static void CFuncDoTrace() { ...@@ -51,7 +51,7 @@ static void CFuncDoTrace() {
#ifdef __GNUC__ #ifdef __GNUC__
fp = reinterpret_cast<unsigned int>(__builtin_frame_address(0)); fp = reinterpret_cast<unsigned int>(__builtin_frame_address(0));
#elif defined _MSC_VER #elif defined _MSC_VER
__asm mov [fp], ebp __asm mov [fp], ebp // NOLINT
#endif #endif
DoTrace(fp); DoTrace(fp);
} }
...@@ -75,7 +75,7 @@ static void CheckRetAddrIsInFunction(unsigned int ret_addr, ...@@ -75,7 +75,7 @@ static void CheckRetAddrIsInFunction(unsigned int ret_addr,
#ifdef DEBUG #ifdef DEBUG
static const int kMaxCFuncLen = 0x40; // seems enough for a small C function static const int kMaxCFuncLen = 0x40; // seems enough for a small C function
static void CheckRetAddrIsInCFunction(unsigned int ret_addr, static void CheckRetAddrIsInCFunction(unsigned int ret_addr,
unsigned int func_start_addr) { unsigned int func_start_addr) {
...@@ -166,10 +166,14 @@ static void SetGlobalProperty(const char* name, Local<Value> value) { ...@@ -166,10 +166,14 @@ static void SetGlobalProperty(const char* name, Local<Value> value) {
} }
static bool Patch(byte* from, size_t num, byte* original, byte* patch, size_t patch_len) { static bool Patch(byte* from,
size_t num,
byte* original,
byte* patch,
size_t patch_len) {
byte* to = from + num; byte* to = from + num;
do { do {
from = (byte*)memchr(from, *original, to - from); from = static_cast<byte*>(memchr(from, *original, to - from));
CHECK(from != NULL); CHECK(from != NULL);
if (memcmp(original, from, patch_len) == 0) { if (memcmp(original, from, patch_len) == 0) {
memcpy(from, patch, patch_len); memcpy(from, patch, patch_len);
...@@ -194,8 +198,10 @@ TEST(PureJSStackTrace) { ...@@ -194,8 +198,10 @@ TEST(PureJSStackTrace) {
v8::internal::Code* call_trace_code = call_trace->code(); v8::internal::Code* call_trace_code = call_trace->code();
CHECK(call_trace_code->IsCode()); CHECK(call_trace_code->IsCode());
byte original[] = { 0x68, 0xcc, 0xcc, 0x00, 0x00 }; // push 0xcccc (= 0x6666 << 1) // push 0xcccc (= 0x6666 << 1)
byte patch[] = { 0x89, 0xe8, 0xd1, 0xe8, 0x50 }; // mov eax,ebp; shr eax; push eax; byte original[] = { 0x68, 0xcc, 0xcc, 0x00, 0x00 };
// mov eax,ebp; shr eax; push eax;
byte patch[] = { 0x89, 0xe8, 0xd1, 0xe8, 0x50 };
// Patch generated code to replace pushing of a constant with // Patch generated code to replace pushing of a constant with
// pushing of ebp contents in a Smi // pushing of ebp contents in a Smi
CHECK(Patch(call_trace_code->instruction_start(), CHECK(Patch(call_trace_code->instruction_start(),
...@@ -212,8 +218,9 @@ TEST(PureJSStackTrace) { ...@@ -212,8 +218,9 @@ TEST(PureJSStackTrace) {
Handle<JSFunction> js_trace(JSFunction::cast(*(v8::Utils::OpenHandle( Handle<JSFunction> js_trace(JSFunction::cast(*(v8::Utils::OpenHandle(
*GetGlobalProperty("JSTrace"))))); *GetGlobalProperty("JSTrace")))));
v8::internal::Code* js_trace_code = js_trace->code(); v8::internal::Code* js_trace_code = js_trace->code();
CheckRetAddrIsInFunction(reinterpret_cast<unsigned int>(sample.stack[0]), CheckRetAddrIsInFunction(
reinterpret_cast<unsigned int>(js_trace_code->instruction_start()), reinterpret_cast<unsigned int>(sample.stack[0]),
js_trace_code->instruction_size()); reinterpret_cast<unsigned int>(js_trace_code->instruction_start()),
js_trace_code->instruction_size());
CHECK_EQ(0, sample.stack[1]); CHECK_EQ(0, sample.stack[1]);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment