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

Side by Side Diff: test/cctest/test-compiler.cc

Issue 7308001: Correctly handle the constant pool in constant pool splitting test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return v8::Utils::OpenHandle(*fun); 360 return v8::Utils::OpenHandle(*fun);
361 } 361 }
362 362
363 363
364 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) { 364 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) {
365 // Create a disassembler with default name lookup. 365 // Create a disassembler with default name lookup.
366 disasm::NameConverter name_converter; 366 disasm::NameConverter name_converter;
367 disasm::Disassembler d(name_converter); 367 disasm::Disassembler d(name_converter);
368 368
369 if (f->code()->kind() == Code::FUNCTION) { 369 if (f->code()->kind() == Code::FUNCTION) {
370 #ifdef DEBUG
371 f->code()->PrintLn();
372 #endif
373 Address pc = f->code()->instruction_start(); 370 Address pc = f->code()->instruction_start();
374 int decode_size = 371 int decode_size =
375 Min(f->code()->instruction_size(), 372 Min(f->code()->instruction_size(),
376 static_cast<int>(f->code()->stack_check_table_offset())); 373 static_cast<int>(f->code()->stack_check_table_offset()));
377 Address end = pc + decode_size; 374 Address end = pc + decode_size;
378 375
379 v8::internal::EmbeddedVector<char, 128> decode_buffer; 376 v8::internal::EmbeddedVector<char, 128> decode_buffer;
380 while (pc < end) { 377 while (pc < end) {
381 PrintF("%08x\n", 378 int num_const = d.ConstantPoolSizeAt(pc);
382 static_cast<unsigned int>(reinterpret_cast<intptr_t>(pc))); 379 if (num_const >= 0) {
383 pc += d.InstructionDecode(decode_buffer, pc); 380 pc += num_const * kPointerSize;
384 CHECK(strstr(decode_buffer.start(), "mov eax,0x178c29c") == NULL); 381 } else {
385 CHECK(strstr(decode_buffer.start(), "push 0x178c29c") == NULL); 382 pc += d.InstructionDecode(decode_buffer, pc);
386 CHECK(strstr(decode_buffer.start(), "0x178c29c") == NULL); 383 CHECK(strstr(decode_buffer.start(), "mov eax,0x178c29c") == NULL);
384 CHECK(strstr(decode_buffer.start(), "push 0x178c29c") == NULL);
385 CHECK(strstr(decode_buffer.start(), "0x178c29c") == NULL);
386 }
387 } 387 }
388 } 388 }
389 } 389 }
390 390
391 391
392 TEST(SplitConstantsInFullCompiler) { 392 TEST(SplitConstantsInFullCompiler) {
393 v8::HandleScope scope; 393 v8::HandleScope scope;
394 LocalContext env; 394 LocalContext env;
395 395
396 CompileRun("function f() { a = 12345678 }; f();"); 396 CompileRun("function f() { a = 12345678 }; f();");
397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
398 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 398 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
404 } 404 }
405 #endif 405 #endif
OLDNEW
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698