1. reduce size of ByteCodeBlock, CodeBlock classes

2. optimize function calling performance
 - change local variable binding order (this, function name first)
 - revise opcode table init method
3. remove OpcodeTable::m_reverseTable
4. use shared thrower JSGetterSetter instance for arguments, function object
5. revise Function.prototype.toString for to print function's source

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2017-03-15 15:05:19 +09:00
commit b1cc608191
29 changed files with 378 additions and 359 deletions

View file

@ -28,8 +28,14 @@ OpcodeTable g_opcodeTable;
OpcodeTable::OpcodeTable()
{
ExecutionState state((Context*)nullptr);
ByteCodeInterpreter::interpret(state, nullptr, 0, nullptr);
Context c;
ExecutionState state(&c);
ByteCodeBlock block;
block.m_code.resize(sizeof(FillOpcodeTable));
size_t* addr = (size_t*)(block.m_code.data() + offsetof(FillOpcodeTable, m_opcodeInAddress));
ByteCodeInterpreter::interpret(state, &block, 0, nullptr, addr);
}
// ECMA-262 11.3 Line Terminators
@ -38,6 +44,21 @@ ALWAYS_INLINE bool isLineTerminator(char16_t ch)
return (ch == 0x0A) || (ch == 0x0D) || (ch == 0x2028) || (ch == 0x2029);
}
void* ByteCodeBlock::operator new(size_t size)
{
static bool typeInited = false;
static GC_descr descr;
if (!typeInited) {
GC_word obj_bitmap[GC_BITMAP_SIZE(ByteCodeBlock)] = { 0 };
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(ByteCodeBlock, m_literalData));
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(ByteCodeBlock, m_codeBlock));
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(ByteCodeBlock, m_objectStructuresInUse));
descr = GC_make_descriptor(obj_bitmap, GC_WORD_LEN(ByteCodeBlock));
typeInited = true;
}
return GC_MALLOC_EXPLICITLY_TYPED(size, descr);
}
void ByteCodeBlock::fillLocDataIfNeeded(Context* c)
{
if (m_locData.size() || (m_codeBlock->src().length() == 0)) {