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

Side by Side Diff: src/x87/assembler-x87.h

Issue 1131783003: Embedded constant pools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix debug-mode Arm issue. Created 5 years, 6 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
« no previous file with comments | « src/x64/frames-x64.cc ('k') | src/x87/assembler-x87.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 (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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // TODO(vitalyr): the assembler does not need an isolate. 488 // TODO(vitalyr): the assembler does not need an isolate.
489 Assembler(Isolate* isolate, void* buffer, int buffer_size); 489 Assembler(Isolate* isolate, void* buffer, int buffer_size);
490 virtual ~Assembler() { } 490 virtual ~Assembler() { }
491 491
492 // GetCode emits any pending (non-emitted) code and fills the descriptor 492 // GetCode emits any pending (non-emitted) code and fills the descriptor
493 // desc. GetCode() is idempotent; it returns the same result if no other 493 // desc. GetCode() is idempotent; it returns the same result if no other
494 // Assembler functions are invoked in between GetCode() calls. 494 // Assembler functions are invoked in between GetCode() calls.
495 void GetCode(CodeDesc* desc); 495 void GetCode(CodeDesc* desc);
496 496
497 // Read/Modify the code target in the branch/call instruction at pc. 497 // Read/Modify the code target in the branch/call instruction at pc.
498 inline static Address target_address_at(Address pc, 498 inline static Address target_address_at(Address pc, Address constant_pool);
499 ConstantPoolArray* constant_pool); 499 inline static void set_target_address_at(
500 inline static void set_target_address_at(Address pc, 500 Address pc, Address constant_pool, Address target,
501 ConstantPoolArray* constant_pool, 501 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
502 Address target,
503 ICacheFlushMode icache_flush_mode =
504 FLUSH_ICACHE_IF_NEEDED);
505 static inline Address target_address_at(Address pc, Code* code) { 502 static inline Address target_address_at(Address pc, Code* code) {
506 ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL; 503 Address constant_pool = code ? code->constant_pool() : NULL;
507 return target_address_at(pc, constant_pool); 504 return target_address_at(pc, constant_pool);
508 } 505 }
509 static inline void set_target_address_at(Address pc, 506 static inline void set_target_address_at(Address pc,
510 Code* code, 507 Code* code,
511 Address target, 508 Address target,
512 ICacheFlushMode icache_flush_mode = 509 ICacheFlushMode icache_flush_mode =
513 FLUSH_ICACHE_IF_NEEDED) { 510 FLUSH_ICACHE_IF_NEEDED) {
514 ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL; 511 Address constant_pool = code ? code->constant_pool() : NULL;
515 set_target_address_at(pc, constant_pool, target); 512 set_target_address_at(pc, constant_pool, target);
516 } 513 }
517 514
518 // Return the code target address at a call site from the return address 515 // Return the code target address at a call site from the return address
519 // of that call in the instruction stream. 516 // of that call in the instruction stream.
520 inline static Address target_address_from_return_address(Address pc); 517 inline static Address target_address_from_return_address(Address pc);
521 518
522 // Return the code target address of the patch debug break slot 519 // Return the code target address of the patch debug break slot
523 inline static Address break_address_from_return_address(Address pc); 520 inline static Address break_address_from_return_address(Address pc);
524 521
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 void RecordComment(const char* msg); 942 void RecordComment(const char* msg);
946 943
947 // Record a deoptimization reason that can be used by a log or cpu profiler. 944 // Record a deoptimization reason that can be used by a log or cpu profiler.
948 // Use --trace-deopt to enable. 945 // Use --trace-deopt to enable.
949 void RecordDeoptReason(const int reason, const SourcePosition position); 946 void RecordDeoptReason(const int reason, const SourcePosition position);
950 947
951 // Writes a single byte or word of data in the code stream. Used for 948 // Writes a single byte or word of data in the code stream. Used for
952 // inline tables, e.g., jump-tables. 949 // inline tables, e.g., jump-tables.
953 void db(uint8_t data); 950 void db(uint8_t data);
954 void dd(uint32_t data); 951 void dd(uint32_t data);
952 void dq(uint64_t data);
953 void dp(uintptr_t data) { dd(data); }
955 void dd(Label* label); 954 void dd(Label* label);
956 955
957 // Check if there is less than kGap bytes available in the buffer. 956 // Check if there is less than kGap bytes available in the buffer.
958 // If this is the case, we need to grow the buffer before emitting 957 // If this is the case, we need to grow the buffer before emitting
959 // an instruction or relocation information. 958 // an instruction or relocation information.
960 inline bool buffer_overflow() const { 959 inline bool buffer_overflow() const {
961 return pc_ >= reloc_info_writer.pos() - kGap; 960 return pc_ >= reloc_info_writer.pos() - kGap;
962 } 961 }
963 962
964 // Get the number of bytes available in the buffer. 963 // Get the number of bytes available in the buffer.
965 inline int available_space() const { return reloc_info_writer.pos() - pc_; } 964 inline int available_space() const { return reloc_info_writer.pos() - pc_; }
966 965
967 static bool IsNop(Address addr); 966 static bool IsNop(Address addr);
968 967
969 PositionsRecorder* positions_recorder() { return &positions_recorder_; } 968 PositionsRecorder* positions_recorder() { return &positions_recorder_; }
970 969
971 int relocation_writer_size() { 970 int relocation_writer_size() {
972 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); 971 return (buffer_ + buffer_size_) - reloc_info_writer.pos();
973 } 972 }
974 973
975 // Avoid overflows for displacements etc. 974 // Avoid overflows for displacements etc.
976 static const int kMaximalBufferSize = 512*MB; 975 static const int kMaximalBufferSize = 512*MB;
977 976
978 byte byte_at(int pos) { return buffer_[pos]; } 977 byte byte_at(int pos) { return buffer_[pos]; }
979 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 978 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
980 979
981 // Allocate a constant pool of the correct size for the generated code. 980 void PatchConstantPoolAccessInstruction(int pc_offset, int offset,
982 Handle<ConstantPoolArray> NewConstantPool(Isolate* isolate); 981 ConstantPoolEntry::Access access,
983 982 ConstantPoolEntry::Type type) {
984 // Generate the constant pool for the generated code. 983 // No embedded constant pool support.
985 void PopulateConstantPool(ConstantPoolArray* constant_pool); 984 UNREACHABLE();
985 }
986 986
987 protected: 987 protected:
988 byte* addr_at(int pos) { return buffer_ + pos; } 988 byte* addr_at(int pos) { return buffer_ + pos; }
989 989
990 990
991 private: 991 private:
992 uint32_t long_at(int pos) { 992 uint32_t long_at(int pos) {
993 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 993 return *reinterpret_cast<uint32_t*>(addr_at(pos));
994 } 994 }
995 void long_at_put(int pos, uint32_t x) { 995 void long_at_put(int pos, uint32_t x) {
996 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 996 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
997 } 997 }
998 998
999 // code emission 999 // code emission
1000 void GrowBuffer(); 1000 void GrowBuffer();
1001 inline void emit(uint32_t x); 1001 inline void emit(uint32_t x);
1002 inline void emit(Handle<Object> handle); 1002 inline void emit(Handle<Object> handle);
1003 inline void emit(uint32_t x, 1003 inline void emit(uint32_t x,
1004 RelocInfo::Mode rmode, 1004 RelocInfo::Mode rmode,
1005 TypeFeedbackId id = TypeFeedbackId::None()); 1005 TypeFeedbackId id = TypeFeedbackId::None());
1006 inline void emit(Handle<Code> code, 1006 inline void emit(Handle<Code> code,
1007 RelocInfo::Mode rmode, 1007 RelocInfo::Mode rmode,
1008 TypeFeedbackId id = TypeFeedbackId::None()); 1008 TypeFeedbackId id = TypeFeedbackId::None());
1009 inline void emit(const Immediate& x); 1009 inline void emit(const Immediate& x);
1010 inline void emit_w(const Immediate& x); 1010 inline void emit_w(const Immediate& x);
1011 inline void emit_q(uint64_t x);
1011 1012
1012 // Emit the code-object-relative offset of the label's position 1013 // Emit the code-object-relative offset of the label's position
1013 inline void emit_code_relative_offset(Label* label); 1014 inline void emit_code_relative_offset(Label* label);
1014 1015
1015 // instruction generation 1016 // instruction generation
1016 void emit_arith_b(int op1, int op2, Register dst, int imm8); 1017 void emit_arith_b(int op1, int op2, Register dst, int imm8);
1017 1018
1018 // Emit a basic arithmetic instruction (i.e. first byte of the family is 0x81) 1019 // Emit a basic arithmetic instruction (i.e. first byte of the family is 0x81)
1019 // with a given destination expression and an immediate operand. It attempts 1020 // with a given destination expression and an immediate operand. It attempts
1020 // to use the shortest encoding possible. 1021 // to use the shortest encoding possible.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 private: 1080 private:
1080 Assembler* assembler_; 1081 Assembler* assembler_;
1081 #ifdef DEBUG 1082 #ifdef DEBUG
1082 int space_before_; 1083 int space_before_;
1083 #endif 1084 #endif
1084 }; 1085 };
1085 1086
1086 } } // namespace v8::internal 1087 } } // namespace v8::internal
1087 1088
1088 #endif // V8_X87_ASSEMBLER_X87_H_ 1089 #endif // V8_X87_ASSEMBLER_X87_H_
OLDNEW
« no previous file with comments | « src/x64/frames-x64.cc ('k') | src/x87/assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698