Chromium Code Reviews

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

Issue 1131783003: Embedded constant pools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address remaining comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 515 matching lines...)
526 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) { 526 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) {
527 // Create a disassembler with default name lookup. 527 // Create a disassembler with default name lookup.
528 disasm::NameConverter name_converter; 528 disasm::NameConverter name_converter;
529 disasm::Disassembler d(name_converter); 529 disasm::Disassembler d(name_converter);
530 530
531 if (f->code()->kind() == Code::FUNCTION) { 531 if (f->code()->kind() == Code::FUNCTION) {
532 Address pc = f->code()->instruction_start(); 532 Address pc = f->code()->instruction_start();
533 int decode_size = 533 int decode_size =
534 Min(f->code()->instruction_size(), 534 Min(f->code()->instruction_size(),
535 static_cast<int>(f->code()->back_edge_table_offset())); 535 static_cast<int>(f->code()->back_edge_table_offset()));
536 if (FLAG_enable_embedded_constant_pool) {
537 decode_size = Min(decode_size, f->code()->constant_pool_offset());
538 }
536 Address end = pc + decode_size; 539 Address end = pc + decode_size;
537 540
538 v8::internal::EmbeddedVector<char, 128> decode_buffer; 541 v8::internal::EmbeddedVector<char, 128> decode_buffer;
539 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; 542 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer;
540 Smi* smi = Smi::FromInt(12345678); 543 Smi* smi = Smi::FromInt(12345678);
541 SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi)); 544 SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi));
542 while (pc < end) { 545 while (pc < end) {
543 int num_const = d.ConstantPoolSizeAt(pc); 546 int num_const = d.ConstantPoolSizeAt(pc);
544 if (num_const >= 0) { 547 if (num_const >= 0) {
545 pc += (num_const + 1) * kPointerSize; 548 pc += (num_const + 1) * kPointerSize;
(...skipping 13 matching lines...)
559 CompileRun("function f() { a = 12345678 }; f();"); 562 CompileRun("function f() { a = 12345678 }; f();");
560 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 563 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
561 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 564 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
562 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 565 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
563 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 566 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
564 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 567 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
565 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 568 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
566 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 569 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
567 } 570 }
568 #endif 571 #endif
OLDNEW

Powered by Google App Engine