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/mips64/simulator-mips64.h b/src/mips64/simulator-mips64.h
index 3087dcd..1d156d8 100644
--- a/src/mips64/simulator-mips64.h
+++ b/src/mips64/simulator-mips64.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)
@@ -43,9 +43,10 @@
void* return_address,
Isolate* isolate);
-#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, p4, p5, p6, p7, NULL, 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, p4, p5, p6, p7, \
+ NULL, p8))
#else // O32 Abi.
@@ -60,9 +61,10 @@
int32_t direct_call,
Isolate* isolate);
-#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))
#endif // MIPS_ABI_N64
@@ -77,14 +79,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
@@ -197,6 +202,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;
@@ -207,17 +218,28 @@
bool test_fcsr_bit(uint32_t cc);
bool set_fcsr_round_error(double original, double rounded);
bool set_fcsr_round64_error(double original, double rounded);
-
+ bool set_fcsr_round_error(float original, float 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 round64_according_to_fcsr(double toRound, double& rounded,
+ int64_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(float toRound, float& rounded,
+ int64_t& rounded_int, float fs);
+ void set_fcsr_rounding_mode(FPURoundingMode mode);
+ unsigned int get_fcsr_rounding_mode();
// Special case of set_register and get_register to access the raw PC value.
void set_pc(int64_t value);
int64_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();
@@ -225,6 +247,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.
@@ -312,19 +336,55 @@
inline int32_t SetDoubleHIW(double* addr);
inline int32_t SetDoubleLOW(double* addr);
+ // functions called from DecodeTypeRegister.
+ void DecodeTypeRegisterCOP1();
+
+ void DecodeTypeRegisterCOP1X();
+
+ void DecodeTypeRegisterSPECIAL();
+
+
+ void DecodeTypeRegisterSPECIAL2();
+
+ void DecodeTypeRegisterSPECIAL3();
+
+ void DecodeTypeRegisterSRsType();
+
+ void DecodeTypeRegisterDRsType();
+
+ void DecodeTypeRegisterWRsType();
+
+ void DecodeTypeRegisterLRsType();
+
// Executing is handled based on the instruction type.
void DecodeTypeRegister(Instruction* instr);
- // Helper function for DecodeTypeRegister.
- void ConfigureTypeRegister(Instruction* instr,
- int64_t* alu_out,
- int64_t* i64hilo,
- uint64_t* u64hilo,
- int64_t* next_pc,
- int64_t* return_addr_reg,
- bool* do_interrupt,
- int64_t* result128H,
- int64_t* result128L);
+ 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 int64_t rs() const { return get_register(rs_reg()); }
+ inline uint64_t rs_u() const {
+ return static_cast<uint64_t>(get_register(rs_reg()));
+ }
+ inline int32_t rt_reg() const { return currentInstr_->RtValue(); }
+ inline int64_t rt() const { return get_register(rt_reg()); }
+ inline uint64_t rt_u() const {
+ return static_cast<uint64_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(const int32_t rd_reg, const int64_t alu_out) {
+ set_register(rd_reg, alu_out);
+ TraceRegWr(alu_out);
+ }
void DecodeTypeImmediate(Instruction* instr);
void DecodeTypeJump(Instruction* instr);
@@ -332,6 +392,18 @@
// Used for breakpoints and traps.
void SoftwareInterrupt(Instruction* instr);
+ // Compact branch guard.
+ void CheckForbiddenSlot(int64_t current_pc) {
+ Instruction* instr_after_compact_branch =
+ reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize);
+ if (instr_after_compact_branch->IsForbiddenAfterBranch()) {
+ V8_Fatal(__FILE__, __LINE__,
+ "Error: Unexpected instruction 0x%08x immediately after a "
+ "compact branch instruction.",
+ *reinterpret_cast<uint32_t*>(instr_after_compact_branch));
+ }
+ }
+
// Stop helper functions.
bool IsWatchpoint(uint64_t code);
void PrintWatchpoint(uint64_t code);
@@ -354,18 +426,19 @@
return;
}
- if (instr->IsForbiddenInBranchDelay()) {
+ if (instr->IsForbiddenAfterBranch()) {
V8_Fatal(__FILE__, __LINE__,
"Eror:Unexpected %i opcode in a branch delay slot.",
instr->OpcodeValue());
}
InstructionDecode(instr);
+ SNPrintF(trace_buf_, " ");
}
// ICache.
static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr);
static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start,
- int size);
+ size_t size);
static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page);
enum Exception {
@@ -375,13 +448,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.
@@ -436,47 +509,51 @@
// 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( \
- FUNCTION_ADDR(entry), 5, reinterpret_cast<int64_t*>(p0), \
- reinterpret_cast<int64_t*>(p1), reinterpret_cast<int64_t*>(p2), \
+#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
+ reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \
+ FUNCTION_ADDR(entry), 5, reinterpret_cast<int64_t*>(p0), \
+ reinterpret_cast<int64_t*>(p1), reinterpret_cast<int64_t*>(p2), \
reinterpret_cast<int64_t*>(p3), reinterpret_cast<int64_t*>(p4)))
#ifdef MIPS_ABI_N64
-#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, p4, p5, p6, p7, NULL, p8)
+#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
+ p7, p8) \
+ static_cast<int>(Simulator::current(isolate)->Call( \
+ entry, 10, p0, p1, p2, p3, p4, reinterpret_cast<int64_t*>(p5), p6, p7, \
+ NULL, p8))
#else // Must be O32 Abi.
-#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) \
+ static_cast<int>(Simulator::current(isolate)->Call( \
+ entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
#endif // MIPS_ABI_N64
// 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_