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

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

Issue 1715003: Add inlining of property load on ARM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 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
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 343
344 void Assembler::Align(int m) { 344 void Assembler::Align(int m) {
345 ASSERT(m >= 4 && IsPowerOf2(m)); 345 ASSERT(m >= 4 && IsPowerOf2(m));
346 while ((pc_offset() & (m - 1)) != 0) { 346 while ((pc_offset() & (m - 1)) != 0) {
347 nop(); 347 nop();
348 } 348 }
349 } 349 }
350 350
351 351
352 bool Assembler::IsB(Instr instr) {
353 return (instr & (B27 | B25)) == (B27 | B25);
354 }
355
356
357 int Assembler::GetBOffset(Instr instr) {
358 ASSERT(IsB(instr));
359 // Take the jump offset in the lower 24 bits, sign extend it and multiply it
360 // with 4 to get the offset in bytes.
361 return ((instr & Imm24Mask) << 8) >> 6;
362 }
363
364
365 bool Assembler::IsLdrRegisterImmediate(Instr instr) {
366 return (instr & (B27 | B26 | B25 | B22 | B20)) == (B26 | B20);
367 }
368
369
370 int Assembler::GetLdrRegisterImmediateOffset(Instr instr) {
371 ASSERT(IsLDRRegisterImmediate(instr));
372 bool positive = (instr & B23) == B23;
373 int offset = instr & Off12Mask; // Zero extended offset.
374 return positive ? offset : -offset;
375 }
376
377
378 Instr Assembler::SetLdrRegisterImmediateOffset(Instr instr, int offset) {
379 ASSERT(IsLDRRegisterImmediate(instr));
380 bool positive = offset >= 0;
381 if (!positive) offset = -offset;
382 ASSERT(is_uint12(offset));
383 // Set bit indicating whether the offset should be added.
384 instr = (instr & ~B23) | (positive ? B23 : 0);
385 // Set the actual offset.
386 return (instr & ~Off12Mask) | offset;
387 }
388
389
352 // Labels refer to positions in the (to be) generated code. 390 // Labels refer to positions in the (to be) generated code.
353 // There are bound, linked, and unused labels. 391 // There are bound, linked, and unused labels.
354 // 392 //
355 // Bound labels refer to known positions in the already 393 // Bound labels refer to known positions in the already
356 // generated code. pos() is the position the label refers to. 394 // generated code. pos() is the position the label refers to.
357 // 395 //
358 // Linked labels refer to unknown positions in the code 396 // Linked labels refer to unknown positions in the code
359 // to be generated; pos() is the position of the last 397 // to be generated; pos() is the position of the last
360 // instruction using the label. 398 // instruction using the label.
361 399
362 400
363 // The link chain is terminated by a negative code position (must be aligned) 401 // The link chain is terminated by a negative code position (must be aligned)
364 const int kEndOfChain = -4; 402 const int kEndOfChain = -4;
365 403
366 404
367 int Assembler::target_at(int pos) { 405 int Assembler::target_at(int pos) {
368 Instr instr = instr_at(pos); 406 Instr instr = instr_at(pos);
369 if ((instr & ~Imm24Mask) == 0) { 407 if ((instr & ~Imm24Mask) == 0) {
370 // Emitted label constant, not part of a branch. 408 // Emitted label constant, not part of a branch.
371 return instr - (Code::kHeaderSize - kHeapObjectTag); 409 return instr - (Code::kHeaderSize - kHeapObjectTag);
372 } 410 }
373 ASSERT((instr & 7*B25) == 5*B25); // b, bl, or blx imm24 411 ASSERT((instr & 7*B25) == 5*B25); // b, bl, or blx imm24
374 int imm26 = ((instr & Imm24Mask) << 8) >> 6; 412 int imm26 = ((instr & Imm24Mask) << 8) >> 6;
375 if ((instr & CondMask) == nv && (instr & B24) != 0) 413 if ((instr & CondMask) == nv && (instr & B24) != 0) {
376 // blx uses bit 24 to encode bit 2 of imm26 414 // blx uses bit 24 to encode bit 2 of imm26
377 imm26 += 2; 415 imm26 += 2;
378 416 }
379 return pos + kPcLoadDelta + imm26; 417 return pos + kPcLoadDelta + imm26;
380 } 418 }
381 419
382 420
383 void Assembler::target_at_put(int pos, int target_pos) { 421 void Assembler::target_at_put(int pos, int target_pos) {
384 Instr instr = instr_at(pos); 422 Instr instr = instr_at(pos);
385 if ((instr & ~Imm24Mask) == 0) { 423 if ((instr & ~Imm24Mask) == 0) {
386 ASSERT(target_pos == kEndOfChain || target_pos >= 0); 424 ASSERT(target_pos == kEndOfChain || target_pos >= 0);
387 // Emitted label constant, not part of a branch. 425 // Emitted label constant, not part of a branch.
388 // Make label relative to Code* of generated Code object. 426 // Make label relative to Code* of generated Code object.
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 bind(&after_pool); 2001 bind(&after_pool);
1964 } 2002 }
1965 2003
1966 // Since a constant pool was just emitted, move the check offset forward by 2004 // Since a constant pool was just emitted, move the check offset forward by
1967 // the standard interval. 2005 // the standard interval.
1968 next_buffer_check_ = pc_offset() + kCheckConstInterval; 2006 next_buffer_check_ = pc_offset() + kCheckConstInterval;
1969 } 2007 }
1970 2008
1971 2009
1972 } } // namespace v8::internal 2010 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/codegen-arm.h » ('j') | src/arm/ic-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698