~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to JavaScriptCore/jit/JIT.h

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#if ENABLE(JIT)
32
32
 
33
 
#define WTF_USE_CTI_REPATCH_PIC 1
 
33
// We've run into some problems where changing the size of the class JIT leads to
 
34
// performance fluctuations.  Try forcing alignment in an attempt to stabalize this.
 
35
#if COMPILER(GCC)
 
36
#define JIT_CLASS_ALIGNMENT __attribute__ ((aligned (32)))
 
37
#else
 
38
#define JIT_CLASS_ALIGNMENT
 
39
#endif
34
40
 
 
41
#include "CodeBlock.h"
35
42
#include "Interpreter.h"
36
43
#include "JITCode.h"
37
44
#include "JITStubs.h"
43
50
#include <wtf/AlwaysInline.h>
44
51
#include <wtf/Vector.h>
45
52
 
46
 
#if PLATFORM(X86_64)
47
 
#define STUB_ARGS_offset 0x10
48
 
#else
49
 
#define STUB_ARGS_offset 0x0C
50
 
#endif
51
 
 
52
 
#define STUB_ARGS_code (STUB_ARGS_offset)
53
 
#define STUB_ARGS_registerFile (STUB_ARGS_offset + 1)
54
 
#define STUB_ARGS_callFrame (STUB_ARGS_offset + 2)
55
 
#define STUB_ARGS_exception (STUB_ARGS_offset + 3)
56
 
#define STUB_ARGS_profilerReference (STUB_ARGS_offset + 4)
57
 
#define STUB_ARGS_globalData (STUB_ARGS_offset + 5)
58
 
 
59
 
#define ARG_callFrame static_cast<CallFrame*>(ARGS[STUB_ARGS_callFrame])
60
 
#define ARG_registerFile static_cast<RegisterFile*>(ARGS[STUB_ARGS_registerFile])
61
 
#define ARG_exception static_cast<JSValuePtr*>(ARGS[STUB_ARGS_exception])
62
 
#define ARG_profilerReference static_cast<Profiler**>(ARGS[STUB_ARGS_profilerReference])
63
 
#define ARG_globalData static_cast<JSGlobalData*>(ARGS[STUB_ARGS_globalData])
64
 
 
65
 
#define ARG_setCallFrame(newCallFrame) (ARGS[STUB_ARGS_callFrame] = (newCallFrame))
66
 
 
67
 
#define ARG_src1 JSValuePtr::decode(static_cast<JSValueEncodedAsPointer*>(ARGS[1]))
68
 
#define ARG_src2 JSValuePtr::decode(static_cast<JSValueEncodedAsPointer*>(ARGS[2]))
69
 
#define ARG_src3 JSValuePtr::decode(static_cast<JSValueEncodedAsPointer*>(ARGS[3]))
70
 
#define ARG_src4 JSValuePtr::decode(static_cast<JSValueEncodedAsPointer*>(ARGS[4]))
71
 
#define ARG_src5 JSValuePtr::decode(static_cast<JSValueEncodedAsPointer*>(ARGS[5]))
72
 
#define ARG_id1 static_cast<Identifier*>(ARGS[1])
73
 
#define ARG_id2 static_cast<Identifier*>(ARGS[2])
74
 
#define ARG_id3 static_cast<Identifier*>(ARGS[3])
75
 
#define ARG_id4 static_cast<Identifier*>(ARGS[4])
76
 
#define ARG_int1 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[1]))
77
 
#define ARG_int2 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[2]))
78
 
#define ARG_int3 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[3]))
79
 
#define ARG_int4 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[4]))
80
 
#define ARG_int5 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[5]))
81
 
#define ARG_int6 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[6]))
82
 
#define ARG_func1 static_cast<FuncDeclNode*>(ARGS[1])
83
 
#define ARG_funcexp1 static_cast<FuncExprNode*>(ARGS[1])
84
 
#define ARG_regexp1 static_cast<RegExp*>(ARGS[1])
85
 
#define ARG_pni1 static_cast<JSPropertyNameIterator*>(ARGS[1])
86
 
#define ARG_returnAddress2 static_cast<void*>(ARGS[2])
87
 
#define ARG_codeBlock4 static_cast<CodeBlock*>(ARGS[4])
88
 
 
89
 
#define STUB_RETURN_ADDRESS_SLOT (ARGS[-1])
90
 
 
91
53
namespace JSC {
92
54
 
93
55
    class CodeBlock;
 
56
    class JIT;
94
57
    class JSPropertyNameIterator;
95
58
    class Interpreter;
96
59
    class Register;
106
69
    struct PolymorphicAccessStructureList;
107
70
    struct StructureStubInfo;
108
71
 
109
 
    typedef JSValueEncodedAsPointer* (JIT_STUB *CTIHelper_j)(STUB_ARGS);
110
 
    typedef JSObject* (JIT_STUB *CTIHelper_o)(STUB_ARGS);
111
 
    typedef JSPropertyNameIterator* (JIT_STUB *CTIHelper_p)(STUB_ARGS);
112
 
    typedef void (JIT_STUB *CTIHelper_v)(STUB_ARGS);
113
 
    typedef void* (JIT_STUB *CTIHelper_s)(STUB_ARGS);
114
 
    typedef int (JIT_STUB *CTIHelper_b)(STUB_ARGS);
115
 
    typedef VoidPtrPair (JIT_STUB *CTIHelper_2)(STUB_ARGS);
116
 
 
117
72
    struct CallRecord {
118
73
        MacroAssembler::Call from;
119
74
        unsigned bytecodeIndex;
201
156
        MacroAssembler::Label coldPathOther;
202
157
    };
203
158
 
204
 
    extern "C" {
205
 
        void ctiVMThrowTrampoline();
206
 
    };
207
 
 
208
 
    void ctiSetReturnAddress(void** addressOfReturnAddress, void* newDestinationToReturnTo);
209
159
    void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, void* newCalleeFunction);
210
160
    void ctiPatchNearCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, void* newCalleeFunction);
211
161
 
212
162
    class JIT : private MacroAssembler {
 
163
        friend class JITStubCall;
 
164
        friend class CallEvalJITStub;
 
165
 
213
166
        using MacroAssembler::Jump;
214
167
        using MacroAssembler::JumpList;
215
168
        using MacroAssembler::Label;
279
232
#if PLATFORM(X86_64)
280
233
        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
281
234
        static const int patchOffsetPutByIdStructure = 10;
 
235
        static const int patchOffsetPutByIdExternalLoad = 20;
 
236
        static const int patchLengthPutByIdExternalLoad = 4;
 
237
        static const int patchLengthPutByIdExternalLoadPrefix = 1;
282
238
        static const int patchOffsetPutByIdPropertyMapOffset = 31;
283
239
        // These architecture specific value are used to enable patching - see comment on op_get_by_id.
284
240
        static const int patchOffsetGetByIdStructure = 10;
285
241
        static const int patchOffsetGetByIdBranchToSlowCase = 20;
 
242
        static const int patchOffsetGetByIdExternalLoad = 20;
 
243
        static const int patchLengthGetByIdExternalLoad = 4;
 
244
        static const int patchLengthGetByIdExternalLoadPrefix = 1;
286
245
        static const int patchOffsetGetByIdPropertyMapOffset = 31;
287
246
        static const int patchOffsetGetByIdPutResult = 31;
288
247
#if ENABLE(OPCODE_SAMPLING)
294
253
#else
295
254
        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
296
255
        static const int patchOffsetPutByIdStructure = 7;
 
256
        static const int patchOffsetPutByIdExternalLoad = 13;
 
257
        static const int patchLengthPutByIdExternalLoad = 3;
 
258
        static const int patchLengthPutByIdExternalLoadPrefix = 0;
297
259
        static const int patchOffsetPutByIdPropertyMapOffset = 22;
298
260
        // These architecture specific value are used to enable patching - see comment on op_get_by_id.
299
261
        static const int patchOffsetGetByIdStructure = 7;
300
262
        static const int patchOffsetGetByIdBranchToSlowCase = 13;
 
263
        static const int patchOffsetGetByIdExternalLoad = 13;
 
264
        static const int patchLengthGetByIdExternalLoad = 3;
 
265
        static const int patchLengthGetByIdExternalLoadPrefix = 0;
301
266
        static const int patchOffsetGetByIdPropertyMapOffset = 22;
302
267
        static const int patchOffsetGetByIdPutResult = 22;
303
268
#if ENABLE(OPCODE_SAMPLING)
315
280
            jit.privateCompile();
316
281
        }
317
282
 
318
 
        static void compileGetByIdSelf(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
319
 
        {
320
 
            JIT jit(globalData, codeBlock);
321
 
            jit.privateCompileGetByIdSelf(stubInfo, structure, cachedOffset, returnAddress);
322
 
        }
323
 
 
324
283
        static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
325
284
        {
326
285
            JIT jit(globalData, codeBlock);
327
286
            jit.privateCompileGetByIdProto(stubInfo, structure, prototypeStructure, cachedOffset, returnAddress, callFrame);
328
287
        }
329
288
 
330
 
#if USE(CTI_REPATCH_PIC)
331
289
        static void compileGetByIdSelfList(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, size_t cachedOffset)
332
290
        {
333
291
            JIT jit(globalData, codeBlock);
343
301
            JIT jit(globalData, codeBlock);
344
302
            jit.privateCompileGetByIdChainList(stubInfo, prototypeStructureList, currentIndex, structure, chain, count, cachedOffset, callFrame);
345
303
        }
346
 
#endif
347
304
 
348
305
        static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress)
349
306
        {
350
307
            JIT jit(globalData, codeBlock);
351
308
            jit.privateCompileGetByIdChain(stubInfo, structure, chain, count, cachedOffset, returnAddress, callFrame);
352
309
        }
353
 
 
354
 
        static void compilePutByIdReplace(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
355
 
        {
356
 
            JIT jit(globalData, codeBlock);
357
 
            jit.privateCompilePutByIdReplace(stubInfo, structure, cachedOffset, returnAddress);
358
 
        }
359
310
        
360
311
        static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ProcessorReturnAddress returnAddress)
361
312
        {
363
314
            jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress);
364
315
        }
365
316
 
366
 
        static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, void** ctiArrayLengthTrampoline, void** ctiStringLengthTrampoline, void** ctiVirtualCallPreLink, void** ctiVirtualCallLink, void** ctiVirtualCall)
367
 
 
 
317
        static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, void** ctiArrayLengthTrampoline, void** ctiStringLengthTrampoline, void** ctiVirtualCallPreLink, void** ctiVirtualCallLink, void** ctiVirtualCall, void** ctiNativeCallThunk)
368
318
        {
369
319
            JIT jit(globalData);
370
 
            jit.privateCompileCTIMachineTrampolines(executablePool, ctiArrayLengthTrampoline, ctiStringLengthTrampoline, ctiVirtualCallPreLink, ctiVirtualCallLink, ctiVirtualCall);
 
320
            jit.privateCompileCTIMachineTrampolines(executablePool, globalData, ctiArrayLengthTrampoline, ctiStringLengthTrampoline, ctiVirtualCallPreLink, ctiVirtualCallLink, ctiVirtualCall, ctiNativeCallThunk);
371
321
        }
372
322
 
373
323
        static void patchGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);
383
333
        static void unlinkCall(CallLinkInfo*);
384
334
 
385
335
    private:
 
336
        struct JSRInfo {
 
337
            DataLabelPtr storeLocation;
 
338
            Label target;
 
339
 
 
340
            JSRInfo(DataLabelPtr storeLocation, Label targetLocation)
 
341
                : storeLocation(storeLocation)
 
342
                , target(targetLocation)
 
343
            {
 
344
            }
 
345
        };
 
346
 
386
347
        JIT(JSGlobalData*, CodeBlock* = 0);
387
348
 
388
349
        void privateCompileMainPass();
389
350
        void privateCompileLinkPass();
390
351
        void privateCompileSlowCases();
391
352
        void privateCompile();
392
 
        void privateCompileGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);
393
353
        void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame);
394
 
#if USE(CTI_REPATCH_PIC)
395
354
        void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, size_t cachedOffset);
396
355
        void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame);
397
356
        void privateCompileGetByIdChainList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, StructureChain* chain, size_t count, size_t cachedOffset, CallFrame* callFrame);
398
 
#endif
399
357
        void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame);
400
 
        void privateCompilePutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);
401
358
        void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ProcessorReturnAddress returnAddress);
402
359
 
403
 
        void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, void** ctiArrayLengthTrampoline, void** ctiStringLengthTrampoline, void** ctiVirtualCallPreLink, void** ctiVirtualCallLink, void** ctiVirtualCall);
 
360
        void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, void** ctiArrayLengthTrampoline, void** ctiStringLengthTrampoline, void** ctiVirtualCallPreLink, void** ctiVirtualCallLink, void** ctiVirtualCall, void** ctiNativeCallThunk);
404
361
        void privateCompilePatchGetArrayLength(ProcessorReturnAddress returnAddress);
405
362
 
406
363
        void addSlowCase(Jump);
416
373
        void compileOpCallInitializeCallFrame();
417
374
        void compileOpCallSetupArgs(Instruction*);
418
375
        void compileOpCallVarargsSetupArgs(Instruction*);
419
 
        void compileOpCallEvalSetupArgs(Instruction*);
420
376
        void compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID);
421
377
        void compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter);
422
378
        void compileOpConstructSetupArgs(Instruction*);
423
379
        enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
424
380
        void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
425
381
 
426
 
        void compileFastArith_op_add(Instruction*);
427
 
        void compileFastArith_op_sub(Instruction*);
428
 
        void compileFastArith_op_mul(Instruction*);
429
 
        void compileFastArith_op_mod(unsigned result, unsigned op1, unsigned op2);
430
 
        void compileFastArith_op_bitand(unsigned result, unsigned op1, unsigned op2);
431
 
        void compileFastArith_op_lshift(unsigned result, unsigned op1, unsigned op2);
432
 
        void compileFastArith_op_rshift(unsigned result, unsigned op1, unsigned op2);
433
 
        void compileFastArith_op_pre_inc(unsigned srcDst);
434
 
        void compileFastArith_op_pre_dec(unsigned srcDst);
435
 
        void compileFastArith_op_post_inc(unsigned result, unsigned srcDst);
436
 
        void compileFastArith_op_post_dec(unsigned result, unsigned srcDst);
437
 
        void compileFastArithSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
438
 
        void compileFastArithSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
439
 
        void compileFastArithSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
440
 
        void compileFastArithSlow_op_mod(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
441
 
        void compileFastArithSlow_op_bitand(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
442
 
        void compileFastArithSlow_op_lshift(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
443
 
        void compileFastArithSlow_op_rshift(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
444
 
        void compileFastArithSlow_op_pre_inc(unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
445
 
        void compileFastArithSlow_op_pre_dec(unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
446
 
        void compileFastArithSlow_op_post_inc(unsigned result, unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
447
 
        void compileFastArithSlow_op_post_dec(unsigned result, unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
 
382
        void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset);
 
383
        void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset);
 
384
        void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset);
 
385
 
 
386
        // Arithmetic Ops
 
387
 
 
388
        void emit_op_add(Instruction*);
 
389
        void emit_op_sub(Instruction*);
 
390
        void emit_op_mul(Instruction*);
 
391
        void emit_op_mod(Instruction*);
 
392
        void emit_op_bitand(Instruction*);
 
393
        void emit_op_lshift(Instruction*);
 
394
        void emit_op_rshift(Instruction*);
 
395
        void emit_op_jnless(Instruction*);
 
396
        void emit_op_jnlesseq(Instruction*);
 
397
        void emit_op_pre_inc(Instruction*);
 
398
        void emit_op_pre_dec(Instruction*);
 
399
        void emit_op_post_inc(Instruction*);
 
400
        void emit_op_post_dec(Instruction*);
 
401
        void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
402
        void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
403
        void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
404
        void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
405
        void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
406
        void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
407
        void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
408
        void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
409
        void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
410
        void emitSlow_op_pre_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
411
        void emitSlow_op_pre_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
412
        void emitSlow_op_post_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
413
        void emitSlow_op_post_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
414
 
 
415
        void emit_op_get_by_val(Instruction*);
 
416
        void emit_op_put_by_val(Instruction*);
 
417
        void emit_op_put_by_index(Instruction*);
 
418
        void emit_op_put_getter(Instruction*);
 
419
        void emit_op_put_setter(Instruction*);
 
420
        void emit_op_del_by_id(Instruction*);
 
421
 
 
422
        void emit_op_mov(Instruction*);
 
423
        void emit_op_end(Instruction*);
 
424
        void emit_op_jmp(Instruction*);
 
425
        void emit_op_loop(Instruction*);
 
426
        void emit_op_loop_if_less(Instruction*);
 
427
        void emit_op_loop_if_lesseq(Instruction*);
 
428
        void emit_op_new_object(Instruction*);
 
429
        void emit_op_put_by_id(Instruction*);
 
430
        void emit_op_get_by_id(Instruction*);
 
431
        void emit_op_instanceof(Instruction*);
 
432
        void emit_op_new_func(Instruction*);
 
433
        void emit_op_call(Instruction*);
 
434
        void emit_op_call_eval(Instruction*);
 
435
        void emit_op_load_varargs(Instruction*);
 
436
        void emit_op_call_varargs(Instruction*);
 
437
        void emit_op_construct(Instruction*);
 
438
        void emit_op_get_global_var(Instruction*);
 
439
        void emit_op_put_global_var(Instruction*);
 
440
        void emit_op_get_scoped_var(Instruction*);
 
441
        void emit_op_put_scoped_var(Instruction*);
 
442
        void emit_op_tear_off_activation(Instruction*);
 
443
        void emit_op_tear_off_arguments(Instruction*);
 
444
        void emit_op_ret(Instruction*);
 
445
        void emit_op_new_array(Instruction*);
 
446
        void emit_op_resolve(Instruction*);
 
447
        void emit_op_construct_verify(Instruction*);
 
448
        void emit_op_to_primitive(Instruction*);
 
449
        void emit_op_strcat(Instruction*);
 
450
        void emit_op_resolve_func(Instruction*);
 
451
        void emit_op_loop_if_true(Instruction*);
 
452
        void emit_op_resolve_base(Instruction*);
 
453
        void emit_op_resolve_skip(Instruction*);
 
454
        void emit_op_resolve_global(Instruction*);
 
455
        void emit_op_not(Instruction*);
 
456
        void emit_op_jfalse(Instruction*);
 
457
        void emit_op_jeq_null(Instruction*);
 
458
        void emit_op_jneq_null(Instruction*);
 
459
        void emit_op_jneq_ptr(Instruction*);
 
460
        void emit_op_unexpected_load(Instruction*);
 
461
        void emit_op_jsr(Instruction*);
 
462
        void emit_op_sret(Instruction*);
 
463
        void emit_op_eq(Instruction*);
 
464
        void emit_op_bitnot(Instruction*);
 
465
        void emit_op_resolve_with_base(Instruction*);
 
466
        void emit_op_new_func_exp(Instruction*);
 
467
        void emit_op_jtrue(Instruction*);
 
468
        void emit_op_neq(Instruction*);
 
469
        void emit_op_bitxor(Instruction*);
 
470
        void emit_op_new_regexp(Instruction*);
 
471
        void emit_op_bitor(Instruction*);
 
472
        void emit_op_throw(Instruction*);
 
473
        void emit_op_next_pname(Instruction*);
 
474
        void emit_op_push_scope(Instruction*);
 
475
        void emit_op_pop_scope(Instruction*);
 
476
        void emit_op_stricteq(Instruction*);
 
477
        void emit_op_nstricteq(Instruction*);
 
478
        void emit_op_to_jsnumber(Instruction*);
 
479
        void emit_op_push_new_scope(Instruction*);
 
480
        void emit_op_catch(Instruction*);
 
481
        void emit_op_jmp_scopes(Instruction*);
 
482
        void emit_op_switch_imm(Instruction*);
 
483
        void emit_op_switch_char(Instruction*);
 
484
        void emit_op_switch_string(Instruction*);
 
485
        void emit_op_new_error(Instruction*);
 
486
        void emit_op_debug(Instruction*);
 
487
        void emit_op_eq_null(Instruction*);
 
488
        void emit_op_neq_null(Instruction*);
 
489
        void emit_op_enter(Instruction*);
 
490
        void emit_op_enter_with_activation(Instruction*);
 
491
        void emit_op_init_arguments(Instruction*);
 
492
        void emit_op_create_arguments(Instruction*);
 
493
        void emit_op_convert_this(Instruction*);
 
494
        void emit_op_profile_will_call(Instruction*);
 
495
        void emit_op_profile_did_call(Instruction*);
 
496
 
 
497
        void emitSlow_op_convert_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
498
        void emitSlow_op_construct_verify(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
499
        void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
500
        void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
501
        void emitSlow_op_loop_if_less(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
502
        void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
503
        void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
504
        void emitSlow_op_loop_if_lesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
505
        void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
506
        void emitSlow_op_loop_if_true(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
507
        void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
508
        void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
509
        void emitSlow_op_bitnot(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
510
        void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
511
        void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
512
        void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
513
        void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
514
        void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
515
        void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
516
        void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
517
        void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
518
        void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
519
        void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
520
        void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
521
        void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
522
        void emitSlow_op_to_jsnumber(Instruction*, Vector<SlowCaseEntry>::iterator&);
 
523
 
448
524
#if ENABLE(JIT_OPTIMIZE_ARITHMETIC)
449
525
        void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
450
526
        void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
462
538
 
463
539
        void emitInitRegister(unsigned dst);
464
540
 
465
 
        void emitPutCTIParam(void* value, unsigned name);
466
 
        void emitPutCTIParam(RegisterID from, unsigned name);
467
 
        void emitGetCTIParam(unsigned name, RegisterID to);
468
 
 
469
541
        void emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry);
470
542
        void emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry);
471
 
        void emitGetFromCallFrameHeader(RegisterFile::CallFrameHeaderEntry entry, RegisterID to);
 
543
        void emitGetFromCallFrameHeaderPtr(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
 
544
        void emitGetFromCallFrameHeader32(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
472
545
 
473
 
        JSValuePtr getConstantOperand(unsigned src);
 
546
        JSValue getConstantOperand(unsigned src);
474
547
        int32_t getConstantOperandImmediateInt(unsigned src);
475
548
        bool isOperandConstantImmediateInt(unsigned src);
476
549
 
528
601
        void restoreArgumentReferenceForTrampoline();
529
602
 
530
603
        Call emitNakedCall(void* function);
531
 
        Call emitCTICall_internal(void*);
532
 
        Call emitCTICall(CTIHelper_j helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
533
 
        Call emitCTICall(CTIHelper_o helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
534
 
        Call emitCTICall(CTIHelper_p helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
535
 
        Call emitCTICall(CTIHelper_v helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
536
 
        Call emitCTICall(CTIHelper_s helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
537
 
        Call emitCTICall(CTIHelper_b helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
538
 
        Call emitCTICall(CTIHelper_2 helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }
539
604
 
540
605
        void emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst);
541
606
        void emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index);
547
612
 
548
613
        void killLastResultRegister();
549
614
 
 
615
 
 
616
#if ENABLE(SAMPLING_FLAGS)
 
617
        void setSamplingFlag(int32_t);
 
618
        void clearSamplingFlag(int32_t);
 
619
#endif
 
620
 
 
621
#if ENABLE(SAMPLING_COUNTERS)
 
622
        void emitCount(AbstractSamplingCounter&, uint32_t = 1);
 
623
#endif
 
624
 
 
625
#if ENABLE(OPCODE_SAMPLING)
 
626
        void sampleInstruction(Instruction*, bool = false);
 
627
#endif
 
628
 
550
629
#if ENABLE(CODEBLOCK_SAMPLING)
551
 
        void sampleCodeBlock(CodeBlock* codeBlock)
552
 
        {
553
 
#if PLATFORM(X86_64)
554
 
            move(ImmPtr(m_interpreter->sampler()->codeBlockSlot()), X86::ecx);
555
 
            storePtr(ImmPtr(codeBlock), X86::ecx);
556
 
#else
557
 
            storePtr(ImmPtr(codeBlock), m_interpreter->sampler()->codeBlockSlot());
558
 
#endif
559
 
        }
 
630
        void sampleCodeBlock(CodeBlock*);
560
631
#else
561
632
        void sampleCodeBlock(CodeBlock*) {}
562
633
#endif
563
634
 
564
 
#if ENABLE(OPCODE_SAMPLING)
565
 
        void sampleInstruction(Instruction* instruction, bool inHostFunction=false)
566
 
        {
567
 
#if PLATFORM(X86_64)
568
 
            move(ImmPtr(m_interpreter->sampler()->sampleSlot()), X86::ecx);
569
 
            storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), X86::ecx);
570
 
#else
571
 
            storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), m_interpreter->sampler()->sampleSlot());
572
 
#endif
573
 
        }
574
 
#else
575
 
        void sampleInstruction(Instruction*, bool) {}
576
 
#endif
 
635
        bool isSSE2Present() const { return m_isSSE2Present; }
577
636
 
578
637
        Interpreter* m_interpreter;
579
638
        JSGlobalData* m_globalData;
585
644
        Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo;
586
645
        Vector<JumpTable> m_jmpTable;
587
646
 
588
 
        struct JSRInfo {
589
 
            DataLabelPtr storeLocation;
590
 
            Label target;
591
 
 
592
 
            JSRInfo(DataLabelPtr storeLocation, Label targetLocation)
593
 
                : storeLocation(storeLocation)
594
 
                , target(targetLocation)
595
 
            {
596
 
            }
597
 
        };
598
 
 
599
647
        unsigned m_bytecodeIndex;
600
648
        Vector<JSRInfo> m_jsrSites;
601
649
        Vector<SlowCaseEntry> m_slowCases;
603
651
 
604
652
        int m_lastResultBytecodeRegister;
605
653
        unsigned m_jumpTargetsPosition;
606
 
    };
 
654
        const bool m_isSSE2Present;
 
655
 
 
656
        unsigned m_propertyAccessInstructionIndex;
 
657
        unsigned m_globalResolveInfoIndex;
 
658
        unsigned m_callLinkInfoIndex;
 
659
    } JIT_CLASS_ALIGNMENT;
 
660
 
607
661
}
608
662
 
609
663
#endif // ENABLE(JIT)