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

Side by Side Diff: src/a64/assembler-a64.cc

Issue 139983007: A64: Indicate the correct size for constant pools. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « no previous file | 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following 10 // copyright notice, this list of conditions and the following
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 // kAvgDistToPool or more. 2377 // kAvgDistToPool or more.
2378 // * no jump is required and the distance to the first instruction accessing 2378 // * no jump is required and the distance to the first instruction accessing
2379 // the constant pool is at least kMaxDistToPool / 2. 2379 // the constant pool is at least kMaxDistToPool / 2.
2380 ASSERT(first_const_pool_use_ >= 0); 2380 ASSERT(first_const_pool_use_ >= 0);
2381 int dist = pc_offset() - first_const_pool_use_; 2381 int dist = pc_offset() - first_const_pool_use_;
2382 if (!force_emit && dist < kAvgDistToPool && 2382 if (!force_emit && dist < kAvgDistToPool &&
2383 (require_jump || (dist < (kMaxDistToPool / 2)))) { 2383 (require_jump || (dist < (kMaxDistToPool / 2)))) {
2384 return; 2384 return;
2385 } 2385 }
2386 2386
2387 Label size_check;
2388 bind(&size_check);
2389
2387 // Check that the code buffer is large enough before emitting the constant 2390 // Check that the code buffer is large enough before emitting the constant
2388 // pool (include the jump over the pool and the constant pool marker and 2391 // pool (include the jump over the pool, the constant pool marker, the
2389 // the gap to the relocation information). 2392 // constant pool guard, and the gap to the relocation information).
2390 int jump_instr = require_jump ? kInstructionSize : 0; 2393 int jump_instr = require_jump ? kInstructionSize : 0;
2391 int size = jump_instr + kInstructionSize + 2394 int size_pool_marker = kInstructionSize;
2392 num_pending_reloc_info_ * kPointerSize; 2395 int size_pool_guard = kInstructionSize;
2393 int needed_space = size + kGap; 2396 int pool_size = jump_instr + size_pool_marker + size_pool_guard +
2397 num_pending_reloc_info_ * kPointerSize;
2398 int needed_space = pool_size + kGap;
2394 while (buffer_space() <= needed_space) { 2399 while (buffer_space() <= needed_space) {
2395 GrowBuffer(); 2400 GrowBuffer();
2396 } 2401 }
2397 2402
2398 { 2403 {
2399 // Block recursive calls to CheckConstPool. 2404 // Block recursive calls to CheckConstPool.
2400 BlockConstPoolScope block_const_pool(this); 2405 BlockConstPoolScope block_const_pool(this);
2401 RecordComment("[ Constant Pool"); 2406 RecordComment("[ Constant Pool");
2402 RecordConstPool(size); 2407 RecordConstPool(pool_size);
2403 2408
2404 // Emit jump over constant pool if necessary. 2409 // Emit jump over constant pool if necessary.
2405 Label after_pool; 2410 Label after_pool;
2406 if (require_jump) { 2411 if (require_jump) {
2407 b(&after_pool); 2412 b(&after_pool);
2408 } 2413 }
2409 2414
2410 // Emit a constant pool header. The header has two goals: 2415 // Emit a constant pool header. The header has two goals:
2411 // 1) Encode the size of the constant pool, for use by the disassembler. 2416 // 1) Encode the size of the constant pool, for use by the disassembler.
2412 // 2) Terminate the program, to try to prevent execution from accidentally 2417 // 2) Terminate the program, to try to prevent execution from accidentally
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 RecordComment("]"); 2449 RecordComment("]");
2445 2450
2446 if (after_pool.is_linked()) { 2451 if (after_pool.is_linked()) {
2447 bind(&after_pool); 2452 bind(&after_pool);
2448 } 2453 }
2449 } 2454 }
2450 2455
2451 // Since a constant pool was just emitted, move the check offset forward by 2456 // Since a constant pool was just emitted, move the check offset forward by
2452 // the standard interval. 2457 // the standard interval.
2453 next_buffer_check_ = pc_offset() + kCheckPoolInterval; 2458 next_buffer_check_ = pc_offset() + kCheckPoolInterval;
2459
2460 ASSERT(SizeOfCodeGeneratedSince(&size_check) ==
2461 static_cast<unsigned>(pool_size));
2454 } 2462 }
2455 2463
2456 2464
2457 void Assembler::RecordComment(const char* msg) { 2465 void Assembler::RecordComment(const char* msg) {
2458 if (FLAG_code_comments) { 2466 if (FLAG_code_comments) {
2459 CheckBuffer(); 2467 CheckBuffer();
2460 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); 2468 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
2461 } 2469 }
2462 } 2470 }
2463 2471
(...skipping 22 matching lines...) Expand all
2486 // code. 2494 // code.
2487 #ifdef ENABLE_DEBUGGER_SUPPORT 2495 #ifdef ENABLE_DEBUGGER_SUPPORT
2488 RecordRelocInfo(RelocInfo::CONST_POOL, static_cast<intptr_t>(size)); 2496 RecordRelocInfo(RelocInfo::CONST_POOL, static_cast<intptr_t>(size));
2489 #endif 2497 #endif
2490 } 2498 }
2491 2499
2492 2500
2493 } } // namespace v8::internal 2501 } } // namespace v8::internal
2494 2502
2495 #endif // V8_TARGET_ARCH_A64 2503 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698