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

Side by Side Diff: src/x64/assembler-x64-inl.h

Issue 23480031: Enable preaging of code objects when --optimize-for-size. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: bool -> enum Created 7 years, 1 month 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/x64/assembler-x64.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 40
41 // ----------------------------------------------------------------------------- 41 // -----------------------------------------------------------------------------
42 // Implementation of Assembler 42 // Implementation of Assembler
43 43
44 44
45 static const byte kCallOpcode = 0xE8; 45 static const byte kCallOpcode = 0xE8;
46 static const int kNoCodeAgeSequenceLength = 6;
46 47
47 48
48 void Assembler::emitl(uint32_t x) { 49 void Assembler::emitl(uint32_t x) {
49 Memory::uint32_at(pc_) = x; 50 Memory::uint32_at(pc_) = x;
50 pc_ += sizeof(uint32_t); 51 pc_ += sizeof(uint32_t);
51 } 52 }
52 53
53 54
54 void Assembler::emitp(void* x, RelocInfo::Mode rmode) { 55 void Assembler::emitp(void* x, RelocInfo::Mode rmode) {
55 uintptr_t value = reinterpret_cast<uintptr_t>(x); 56 uintptr_t value = reinterpret_cast<uintptr_t>(x);
(...skipping 16 matching lines...) Expand all
72 73
73 void Assembler::emitw(uint16_t x) { 74 void Assembler::emitw(uint16_t x) {
74 Memory::uint16_at(pc_) = x; 75 Memory::uint16_at(pc_) = x;
75 pc_ += sizeof(uint16_t); 76 pc_ += sizeof(uint16_t);
76 } 77 }
77 78
78 79
79 void Assembler::emit_code_target(Handle<Code> target, 80 void Assembler::emit_code_target(Handle<Code> target,
80 RelocInfo::Mode rmode, 81 RelocInfo::Mode rmode,
81 TypeFeedbackId ast_id) { 82 TypeFeedbackId ast_id) {
82 ASSERT(RelocInfo::IsCodeTarget(rmode)); 83 ASSERT(RelocInfo::IsCodeTarget(rmode) ||
84 rmode == RelocInfo::CODE_AGE_SEQUENCE);
83 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { 85 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) {
84 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, ast_id.ToInt()); 86 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, ast_id.ToInt());
85 } else { 87 } else {
86 RecordRelocInfo(rmode); 88 RecordRelocInfo(rmode);
87 } 89 }
88 int current = code_targets_.length(); 90 int current = code_targets_.length();
89 if (current > 0 && code_targets_.last().is_identical_to(target)) { 91 if (current > 0 && code_targets_.last().is_identical_to(target)) {
90 // Optimization if we keep jumping to the same code target. 92 // Optimization if we keep jumping to the same code target.
91 emitl(current - 1); 93 emitl(current - 1);
92 } else { 94 } else {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return false; 387 return false;
386 #endif 388 #endif
387 } 389 }
388 390
389 391
390 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { 392 bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
391 return !Assembler::IsNop(pc()); 393 return !Assembler::IsNop(pc());
392 } 394 }
393 395
394 396
397 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) {
398 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
399 ASSERT(*pc_ == kCallOpcode);
400 return origin->code_target_object_handle_at(pc_ + 1);
401 }
402
403
395 Code* RelocInfo::code_age_stub() { 404 Code* RelocInfo::code_age_stub() {
396 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 405 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
397 ASSERT(*pc_ == kCallOpcode); 406 ASSERT(*pc_ == kCallOpcode);
398 return Code::GetCodeFromTargetAddress( 407 return Code::GetCodeFromTargetAddress(
399 Assembler::target_address_at(pc_ + 1)); 408 Assembler::target_address_at(pc_ + 1));
400 } 409 }
401 410
402 411
403 void RelocInfo::set_code_age_stub(Code* stub) { 412 void RelocInfo::set_code_age_stub(Code* stub) {
404 ASSERT(*pc_ == kCallOpcode); 413 ASSERT(*pc_ == kCallOpcode);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 ASSERT(len_ == 1 || len_ == 2); 548 ASSERT(len_ == 1 || len_ == 2);
540 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); 549 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
541 *p = disp; 550 *p = disp;
542 len_ += sizeof(int32_t); 551 len_ += sizeof(int32_t);
543 } 552 }
544 553
545 554
546 } } // namespace v8::internal 555 } } // namespace v8::internal
547 556
548 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 557 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698