Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/mips/simulator-mips.h b/src/mips/simulator-mips.h
index 85f6477..8efe0bb 100644
--- a/src/mips/simulator-mips.h
+++ b/src/mips/simulator-mips.h
@@ -23,7 +23,7 @@
namespace internal {
// When running without a simulator we call the entry directly.
-#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
+#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
entry(p0, p1, p2, p3, p4)
typedef int (*mips_regexp_matcher)(String*, int, const byte*, const byte*,
@@ -34,9 +34,10 @@
// should act as a function matching the type arm_regexp_matcher.
// The fifth argument is a dummy that reserves the space used for
// the return address added by the ExitFrame in native calls.
-#define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
- (FUNCTION_CAST<mips_regexp_matcher>(entry)( \
- p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
+#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
+ p7, p8) \
+ (FUNCTION_CAST<mips_regexp_matcher>(entry)(p0, p1, p2, p3, NULL, p4, p5, p6, \
+ p7, p8))
// The stack limit beyond which we will throw stack overflow errors in
// generated code. Because generated code on mips uses the C stack, we
@@ -48,14 +49,17 @@
return c_limit;
}
- static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
+ static inline uintptr_t RegisterCTryCatch(Isolate* isolate,
+ uintptr_t try_catch_address) {
+ USE(isolate);
return try_catch_address;
}
- static inline void UnregisterCTryCatch() { }
+ static inline void UnregisterCTryCatch(Isolate* isolate) { USE(isolate); }
};
-} } // namespace v8::internal
+} // namespace internal
+} // namespace v8
// Calculated the stack limit beyond which we will throw stack overflow errors.
// This macro must be called from a C++ method. It relies on being able to take
@@ -167,6 +171,12 @@
void set_fpu_register_hi_word(int fpureg, int32_t value);
void set_fpu_register_float(int fpureg, float value);
void set_fpu_register_double(int fpureg, double value);
+ void set_fpu_register_invalid_result64(float original, float rounded);
+ void set_fpu_register_invalid_result(float original, float rounded);
+ void set_fpu_register_word_invalid_result(float original, float rounded);
+ void set_fpu_register_invalid_result64(double original, double rounded);
+ void set_fpu_register_invalid_result(double original, double rounded);
+ void set_fpu_register_word_invalid_result(double original, double rounded);
int64_t get_fpu_register(int fpureg) const;
int32_t get_fpu_register_word(int fpureg) const;
int32_t get_fpu_register_signed_word(int fpureg) const;
@@ -175,18 +185,30 @@
double get_fpu_register_double(int fpureg) const;
void set_fcsr_bit(uint32_t cc, bool value);
bool test_fcsr_bit(uint32_t cc);
+ void set_fcsr_rounding_mode(FPURoundingMode mode);
+ unsigned int get_fcsr_rounding_mode();
bool set_fcsr_round_error(double original, double rounded);
-
+ bool set_fcsr_round_error(float original, float rounded);
+ bool set_fcsr_round64_error(double original, double rounded);
+ bool set_fcsr_round64_error(float original, float rounded);
+ void round_according_to_fcsr(double toRound, double& rounded,
+ int32_t& rounded_int, double fs);
+ void round_according_to_fcsr(float toRound, float& rounded,
+ int32_t& rounded_int, float fs);
+ void round64_according_to_fcsr(double toRound, double& rounded,
+ int64_t& rounded_int, double fs);
+ void round64_according_to_fcsr(float toRound, float& rounded,
+ int64_t& rounded_int, float fs);
// Special case of set_register and get_register to access the raw PC value.
void set_pc(int32_t value);
int32_t get_pc() const;
- Address get_sp() {
+ Address get_sp() const {
return reinterpret_cast<Address>(static_cast<intptr_t>(get_register(sp)));
}
// Accessor to the internal simulator stack area.
- uintptr_t StackLimit() const;
+ uintptr_t StackLimit(uintptr_t c_limit) const;
// Executes MIPS instructions until the PC reaches end_sim_pc.
void Execute();
@@ -194,6 +216,8 @@
// Call on program start.
static void Initialize(Isolate* isolate);
+ static void TearDown(HashMap* i_cache, Redirection* first);
+
// V8 generally calls into generated JS code with 5 parameters and into
// generated RegExp code with 7 parameters. This is a convenience function,
// which sets up the simulator state and grabs the result on return.
@@ -254,6 +278,20 @@
inline double ReadD(int32_t addr, Instruction* instr);
inline void WriteD(int32_t addr, double value, Instruction* instr);
+ // Helpers for data value tracing.
+ enum TraceType {
+ BYTE,
+ HALF,
+ WORD
+ // DWORD,
+ // DFLOAT - Floats may have printing issues due to paired lwc1's
+ };
+
+ void TraceRegWr(int32_t value);
+ void TraceMemWr(int32_t addr, int32_t value, TraceType t);
+ void TraceMemRd(int32_t addr, int32_t value);
+ EmbeddedVector<char, 128> trace_buf_;
+
// Operations depending on endianness.
// Get Double Higher / Lower word.
inline int32_t GetDoubleHIW(double* addr);
@@ -265,14 +303,53 @@
// Executing is handled based on the instruction type.
void DecodeTypeRegister(Instruction* instr);
- // Helper function for DecodeTypeRegister.
- void ConfigureTypeRegister(Instruction* instr,
- int32_t* alu_out,
- int64_t* i64hilo,
- uint64_t* u64hilo,
- int32_t* next_pc,
- int32_t* return_addr_reg,
- bool* do_interrupt);
+ // Functions called from DecodeTypeRegister.
+ void DecodeTypeRegisterCOP1();
+
+ void DecodeTypeRegisterCOP1X();
+
+ void DecodeTypeRegisterSPECIAL();
+
+ void DecodeTypeRegisterSPECIAL2();
+
+ void DecodeTypeRegisterSPECIAL3();
+
+ // Called from DecodeTypeRegisterCOP1.
+ void DecodeTypeRegisterSRsType();
+
+ void DecodeTypeRegisterDRsType();
+
+ void DecodeTypeRegisterWRsType();
+
+ void DecodeTypeRegisterLRsType();
+
+ Instruction* currentInstr_;
+
+ inline Instruction* get_instr() const { return currentInstr_; }
+ inline void set_instr(Instruction* instr) { currentInstr_ = instr; }
+
+ inline int32_t rs_reg() const { return currentInstr_->RsValue(); }
+ inline int32_t rs() const { return get_register(rs_reg()); }
+ inline uint32_t rs_u() const {
+ return static_cast<uint32_t>(get_register(rs_reg()));
+ }
+ inline int32_t rt_reg() const { return currentInstr_->RtValue(); }
+ inline int32_t rt() const { return get_register(rt_reg()); }
+ inline uint32_t rt_u() const {
+ return static_cast<uint32_t>(get_register(rt_reg()));
+ }
+ inline int32_t rd_reg() const { return currentInstr_->RdValue(); }
+ inline int32_t fr_reg() const { return currentInstr_->FrValue(); }
+ inline int32_t fs_reg() const { return currentInstr_->FsValue(); }
+ inline int32_t ft_reg() const { return currentInstr_->FtValue(); }
+ inline int32_t fd_reg() const { return currentInstr_->FdValue(); }
+ inline int32_t sa() const { return currentInstr_->SaValue(); }
+ inline int32_t lsa_sa() const { return currentInstr_->LsaSaValue(); }
+
+ inline void SetResult(int32_t rd_reg, int32_t alu_out) {
+ set_register(rd_reg, alu_out);
+ TraceRegWr(alu_out);
+ }
void DecodeTypeImmediate(Instruction* instr);
void DecodeTypeJump(Instruction* instr);
@@ -280,6 +357,18 @@
// Used for breakpoints and traps.
void SoftwareInterrupt(Instruction* instr);
+ // Compact branch guard.
+ void CheckForbiddenSlot(int32_t current_pc) {
+ Instruction* instr_aftter_compact_branch =
+ reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize);
+ if (instr_aftter_compact_branch->IsForbiddenInBranchDelay()) {
+ V8_Fatal(__FILE__, __LINE__,
+ "Error: Unexpected instruction 0x%08x immediately after a "
+ "compact branch instruction.",
+ *reinterpret_cast<uint32_t*>(instr_aftter_compact_branch));
+ }
+ }
+
// Stop helper functions.
bool IsWatchpoint(uint32_t code);
void PrintWatchpoint(uint32_t code);
@@ -308,6 +397,7 @@
instr->OpcodeValue());
}
InstructionDecode(instr);
+ SNPrintF(trace_buf_, " ");
}
// ICache.
@@ -323,13 +413,13 @@
kDivideByZero,
kNumExceptions
};
- int16_t exceptions[kNumExceptions];
// Exceptions.
- void SignalExceptions();
+ void SignalException(Exception e);
// Runtime call support.
- static void* RedirectExternalReference(void* external_function,
+ static void* RedirectExternalReference(Isolate* isolate,
+ void* external_function,
ExternalReference::Type type);
// Handle arguments and return value for runtime FP functions.
@@ -353,7 +443,7 @@
static const size_t stack_size_ = 1 * 1024*1024;
char* stack_;
bool pc_modified_;
- int icount_;
+ uint64_t icount_;
int break_count_;
// Debugger input.
@@ -385,38 +475,40 @@
// When running with the simulator transition into simulated execution at this
// point.
-#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
- reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \
+#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
+ reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \
FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
-#define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
- Simulator::current(Isolate::Current())->Call( \
- entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
+#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
+ p7, p8) \
+ Simulator::current(isolate) \
+ ->Call(entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
// The simulator has its own stack. Thus it has a different stack limit from
-// the C-based native code. Setting the c_limit to indicate a very small
-// stack cause stack overflow errors, since the simulator ignores the input.
-// This is unlikely to be an issue in practice, though it might cause testing
-// trouble down the line.
+// the C-based native code. The JS-based limit normally points near the end of
+// the simulator stack. When the C-based limit is exhausted we reflect that by
+// lowering the JS-based limit as well, to make stack checks trigger.
class SimulatorStack : public v8::internal::AllStatic {
public:
static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
uintptr_t c_limit) {
- return Simulator::current(isolate)->StackLimit();
+ return Simulator::current(isolate)->StackLimit(c_limit);
}
- static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
- Simulator* sim = Simulator::current(Isolate::Current());
+ static inline uintptr_t RegisterCTryCatch(Isolate* isolate,
+ uintptr_t try_catch_address) {
+ Simulator* sim = Simulator::current(isolate);
return sim->PushAddress(try_catch_address);
}
- static inline void UnregisterCTryCatch() {
- Simulator::current(Isolate::Current())->PopAddress();
+ static inline void UnregisterCTryCatch(Isolate* isolate) {
+ Simulator::current(isolate)->PopAddress();
}
};
-} } // namespace v8::internal
+} // namespace internal
+} // namespace v8
#endif // !defined(USE_SIMULATOR)
#endif // V8_MIPS_SIMULATOR_MIPS_H_