39 using namespace v8::internal;
43 typedef int (*
F1)(
int x);
44 typedef int (*
F2)(
int x,
int y);
50 static void InitializeVM() {
64 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
76 CHECK(code->IsCode());
82 ::printf(
"f() = %d\n", res);
92 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
101 __ sub(
edx, Immediate(1));
114 CHECK(code->IsCode());
120 ::printf(
"f() = %d\n", res);
130 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
139 __ sub(
edx, Immediate(1));
156 CHECK(code->IsCode());
162 ::printf(
"f() = %d\n", res);
167 typedef int (*
F3)(
float x);
176 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
179 { CpuFeatures::Scope fscope(
SSE2);
195 F3 f = FUNCTION_CAST<F3>(code->
entry());
196 int res = f(static_cast<float>(-3.1415));
197 ::printf(
"f() = %d\n", res);
202 typedef int (*
F4)(
double x);
211 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
214 CpuFeatures::Scope fscope(
SSE2);
229 F4 f = FUNCTION_CAST<F4>(code->
entry());
230 int res = f(2.718281828);
231 ::printf(
"f() = %d\n", res);
242 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
253 F0 f = FUNCTION_CAST<F0>(code->
entry());
259 typedef double (*
F5)(
double x,
double y);
267 CpuFeatures::Scope fscope(
SSE2);
269 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
278 __ sub(
esp, Immediate(8));
280 __ fld_d(Operand(
esp, 0));
281 __ add(
esp, Immediate(8));
298 F5 f = FUNCTION_CAST<F5>(code->
entry());
299 double res = f(2.2, 1.1);
300 ::printf(
"f() = %f\n", res);
301 CHECK(2.29 < res && res < 2.31);
305 typedef double (*
F6)(
int x);
313 CpuFeatures::Scope fscope(
SSE2);
315 Assembler assm(Isolate::Current(), buffer,
sizeof buffer);
319 __ sub(
esp, Immediate(8));
321 __ fld_d(Operand(
esp, 0));
322 __ add(
esp, Immediate(8));
330 CHECK(code->IsCode());
337 ::printf(
"f() = %f\n", res);
338 CHECK(11.99 < res && res < 12.001);
342 typedef int (*
F7)(
double x,
double y);
349 enum { kEqual = 0, kGreater = 1, kLess = 2, kNaN = 3, kUndefined = 4 };
350 Label equal_l, less_l, greater_l, nan_l;
359 __ mov(
eax, kUndefined);
367 __ mov(
eax, kGreater);
385 CHECK(code->IsCode());
416 Assembler assm(Isolate::Current(), buffer,
sizeof(buffer));
428 for (
int i = 0; i < 16; i++) {
469 CHECK(code->IsCode());
471 F0 f = FUNCTION_CAST<F0>(code->
entry());
#define CHECK_EQ(expected, value)
static bool IsSupported(CpuFeature f)
static Code * cast(Object *obj)
byte * instruction_start()
void GetCode(CodeDesc *desc)
int(* F7)(double x, double y)
static double nan_value()
double(* F5)(double x, double y)
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, PropertyType type=NORMAL, int argc=-1, InlineCacheHolderFlag holder=OWN_MAP)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
#define RUNTIME_ENTRY(name, nargs, ressize)
static void Dump(FILE *f, byte *begin, byte *end)