Merge V8 5.4.500.40
Test: Manual - built & ran d8
Change-Id: I4edfa2853d3e565b729723645395688ece3193f4
diff --git a/src/compiler/code-assembler.h b/src/compiler/code-assembler.h
index c33605c..bea999b 100644
--- a/src/compiler/code-assembler.h
+++ b/src/compiler/code-assembler.h
@@ -6,11 +6,12 @@
#define V8_COMPILER_CODE_ASSEMBLER_H_
#include <map>
+#include <memory>
// Clients of this interface shouldn't depend on lots of compiler internals.
// Do not include anything from src/compiler here!
#include "src/allocation.h"
-#include "src/builtins.h"
+#include "src/builtins/builtins.h"
#include "src/heap/heap.h"
#include "src/machine-type.h"
#include "src/runtime/runtime.h"
@@ -28,12 +29,9 @@
namespace compiler {
class CallDescriptor;
-class Graph;
class Node;
-class Operator;
class RawMachineAssembler;
class RawMachineLabel;
-class Schedule;
#define CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(V) \
V(Float32Equal) \
@@ -56,6 +54,7 @@
V(IntPtrGreaterThanOrEqual) \
V(IntPtrEqual) \
V(Uint32LessThan) \
+ V(Uint32GreaterThanOrEqual) \
V(UintPtrLessThan) \
V(UintPtrGreaterThanOrEqual) \
V(WordEqual) \
@@ -73,6 +72,7 @@
V(Float64Div) \
V(Float64Mod) \
V(Float64Atan2) \
+ V(Float64Pow) \
V(Float64InsertLowWord32) \
V(Float64InsertHighWord32) \
V(IntPtrAdd) \
@@ -84,7 +84,9 @@
V(Int32AddWithOverflow) \
V(Int32Sub) \
V(Int32Mul) \
+ V(Int32MulWithOverflow) \
V(Int32Div) \
+ V(Int32Mod) \
V(WordOr) \
V(WordAnd) \
V(WordXor) \
@@ -107,9 +109,15 @@
V(Word64Ror)
#define CODE_ASSEMBLER_UNARY_OP_LIST(V) \
+ V(Float64Abs) \
+ V(Float64Acos) \
+ V(Float64Acosh) \
+ V(Float64Asin) \
+ V(Float64Asinh) \
V(Float64Atan) \
V(Float64Atanh) \
V(Float64Cos) \
+ V(Float64Cosh) \
V(Float64Exp) \
V(Float64Expm1) \
V(Float64Log) \
@@ -119,13 +127,17 @@
V(Float64Cbrt) \
V(Float64Neg) \
V(Float64Sin) \
+ V(Float64Sinh) \
V(Float64Sqrt) \
V(Float64Tan) \
+ V(Float64Tanh) \
V(Float64ExtractLowWord32) \
V(Float64ExtractHighWord32) \
V(BitcastWordToTagged) \
+ V(TruncateFloat64ToFloat32) \
V(TruncateFloat64ToWord32) \
V(TruncateInt64ToInt32) \
+ V(ChangeFloat32ToFloat64) \
V(ChangeFloat64ToUint32) \
V(ChangeInt32ToFloat64) \
V(ChangeInt32ToInt64) \
@@ -192,14 +204,6 @@
CodeAssembler* assembler_;
};
- enum AllocationFlag : uint8_t {
- kNone = 0,
- kDoubleAlignment = 1,
- kPretenured = 1 << 1
- };
-
- typedef base::Flags<AllocationFlag> AllocationFlags;
-
// ===========================================================================
// Base Assembler
// ===========================================================================
@@ -232,9 +236,12 @@
void GotoUnless(Node* condition, Label* false_label);
void Branch(Node* condition, Label* true_label, Label* false_label);
- void Switch(Node* index, Label* default_label, int32_t* case_values,
+ void Switch(Node* index, Label* default_label, const int32_t* case_values,
Label** case_labels, size_t case_count);
+ Node* Select(Node* condition, Node* true_value, Node* false_value,
+ MachineRepresentation rep = MachineRepresentation::kTagged);
+
// Access to the frame pointer
Node* LoadFramePointer();
Node* LoadParentFramePointer();
@@ -269,6 +276,7 @@
Node* WordShl(Node* value, int shift);
Node* WordShr(Node* value, int shift);
+ Node* Word32Shr(Node* value, int shift);
// Unary
#define DECLARE_CODE_ASSEMBLER_UNARY_OP(name) Node* name(Node* a);
@@ -304,6 +312,18 @@
Node* arg1, Node* arg2, Node* arg3);
Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
Node* arg1, Node* arg2, Node* arg3, Node* arg4);
+ Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
+ Node* arg1, Node* arg2, Node* arg3, Node* arg4,
+ Node* arg5);
+
+ // A pair of a zero-based argument index and a value.
+ // It helps writing arguments order independent code.
+ struct Arg {
+ Arg(int index, Node* value) : index(index), value(value) {}
+
+ int const index;
+ Node* const value;
+ };
Node* CallStub(Callable const& callable, Node* context, Node* arg1,
size_t result_size = 1);
@@ -315,6 +335,8 @@
size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, size_t result_size = 1);
+ Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, Node* arg1, size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, Node* arg1, Node* arg2, size_t result_size = 1);
@@ -327,13 +349,35 @@
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, Node* arg1, Node* arg2, Node* arg3, Node* arg4,
Node* arg5, size_t result_size = 1);
+
+ Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, const Arg& arg1, const Arg& arg2,
+ size_t result_size = 1);
+ Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, const Arg& arg1, const Arg& arg2,
+ const Arg& arg3, size_t result_size = 1);
+ Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, const Arg& arg1, const Arg& arg2,
+ const Arg& arg3, const Arg& arg4, size_t result_size = 1);
+ Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, const Arg& arg1, const Arg& arg2,
+ const Arg& arg3, const Arg& arg4, const Arg& arg5,
+ size_t result_size = 1);
+
Node* CallStubN(const CallInterfaceDescriptor& descriptor, Node* target,
Node** args, size_t result_size = 1);
Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
+ size_t result_size = 1);
+ Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
Node* arg2, size_t result_size = 1);
Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
Node* arg2, Node* arg3, size_t result_size = 1);
+ Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
+ Node* arg2, Node* arg3, Node* arg4,
+ size_t result_size = 1);
+ Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, Node* arg1, size_t result_size = 1);
Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, Node* arg1, Node* arg2,
size_t result_size = 1);
@@ -344,6 +388,14 @@
Node* context, Node* arg1, Node* arg2, Node* arg3,
Node* arg4, size_t result_size = 1);
+ Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, const Arg& arg1, const Arg& arg2,
+ const Arg& arg3, const Arg& arg4, size_t result_size = 1);
+ Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
+ Node* context, const Arg& arg1, const Arg& arg2,
+ const Arg& arg3, const Arg& arg4, const Arg& arg5,
+ size_t result_size = 1);
+
Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor,
Node* code_target_address, Node** args);
@@ -354,6 +406,10 @@
Node* CallJS(Callable const& callable, Node* context, Node* function,
Node* receiver, Node* arg1, Node* arg2, size_t result_size = 1);
+ // Exception handling support.
+ void GotoIfException(Node* node, Label* if_exception,
+ Variable* exception_var = nullptr);
+
// Branching helpers.
void BranchIf(Node* condition, Label* if_true, Label* if_false);
@@ -370,11 +426,6 @@
Zone* zone() const;
protected:
- // Protected helpers which delegate to RawMachineAssembler.
- Graph* graph() const;
-
- Node* SmiShiftBitsConstant();
-
// Enables subclasses to perform operations before and after a call.
virtual void CallPrologue();
virtual void CallEpilogue();
@@ -386,7 +437,7 @@
Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
- base::SmartPointer<RawMachineAssembler> raw_assembler_;
+ std::unique_ptr<RawMachineAssembler> raw_assembler_;
Code::Flags flags_;
const char* name_;
bool code_generated_;
@@ -395,8 +446,6 @@
DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
};
-DEFINE_OPERATORS_FOR_FLAGS(CodeAssembler::AllocationFlags);
-
class CodeAssembler::Label {
public:
enum Type { kDeferred, kNonDeferred };