diff options
| author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
| commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
| tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /JavaScriptCore/bytecompiler | |
| parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
| download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 | |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'JavaScriptCore/bytecompiler')
| -rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.cpp | 24 | ||||
| -rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.h | 3 | ||||
| -rw-r--r-- | JavaScriptCore/bytecompiler/NodesCodegen.cpp | 4 |
3 files changed, 12 insertions, 19 deletions
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index f2193b0..aa5c5f9 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -34,6 +34,8 @@ #include "PrototypeFunction.h" #include "JSFunction.h" #include "Interpreter.h" +#include "RegExp.h" +#include "RegExpObject.h" #include "UString.h" using namespace std; @@ -827,11 +829,6 @@ RegisterID* BytecodeGenerator::addConstantValue(JSValue v) return &m_constantPoolRegisters[index]; } -unsigned BytecodeGenerator::addRegExp(RegExp* r) -{ - return m_codeBlock->addRegExp(r); -} - RegisterID* BytecodeGenerator::emitMove(RegisterID* dst, RegisterID* src) { emitOpcode(op_mov); @@ -982,6 +979,12 @@ RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, const Identifier& ident return emitLoad(dst, JSValue(stringInMap)); } +RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, RegExp* regExp) +{ + JSValue jsRegExp = new (globalData()) RegExpObject(m_scopeChain->globalObject()->regExpStructure(), regExp); + return emitLoad(dst, jsRegExp); +} + RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, JSValue v) { RegisterID* constantID = addConstantValue(v); @@ -1361,15 +1364,6 @@ RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode return dst; } -RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) -{ - emitOpcode(op_new_regexp); - instructions().append(dst->index()); - instructions().append(addRegExp(regExp)); - return dst; -} - - RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) { FunctionBodyNode* function = n->body(); @@ -1942,7 +1936,7 @@ static int32_t keyForCharacterSwitch(ExpressionNode* node, int32_t min, int32_t UString::Rep* clause = static_cast<StringNode*>(node)->value().ustring().rep(); ASSERT(clause->length() == 1); - int32_t key = clause->data()[0]; + int32_t key = clause->characters()[0]; ASSERT(key >= min); ASSERT(key <= max); return key - min; diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 8b6a425..919183e 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -264,6 +264,7 @@ namespace JSC { RegisterID* emitLoad(RegisterID* dst, bool); RegisterID* emitLoad(RegisterID* dst, double); RegisterID* emitLoad(RegisterID* dst, const Identifier&); + RegisterID* emitLoad(RegisterID* dst, RegExp* regExp); RegisterID* emitLoad(RegisterID* dst, JSValue); RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src); @@ -276,7 +277,6 @@ namespace JSC { RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body); RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func); - RegisterID* emitNewRegExp(RegisterID* dst, RegExp* regExp); RegisterID* emitMove(RegisterID* dst, RegisterID* src); @@ -446,7 +446,6 @@ namespace JSC { unsigned addConstant(const Identifier&); RegisterID* addConstantValue(JSValue); - unsigned addRegExp(RegExp*); PassRefPtr<FunctionExecutable> makeFunction(ExecState* exec, FunctionBodyNode* body) { diff --git a/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/JavaScriptCore/bytecompiler/NodesCodegen.cpp index 4162873..aaf2dd1 100644 --- a/JavaScriptCore/bytecompiler/NodesCodegen.cpp +++ b/JavaScriptCore/bytecompiler/NodesCodegen.cpp @@ -149,7 +149,7 @@ RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d return emitThrowError(generator, SyntaxError, "Invalid regular expression: %s", regExp->errorMessage()); if (dst == generator.ignoredResult()) return 0; - return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get()); + return generator.emitLoad(generator.finalDestination(dst), regExp.get()); } // ------------------------------ ThisNode ------------------------------------- @@ -1699,7 +1699,7 @@ static void processClauseList(ClauseListNode* list, Vector<ExpressionNode*, 8>& } const UString& value = static_cast<StringNode*>(clauseExpression)->value().ustring(); if (singleCharacterSwitch &= value.size() == 1) { - int32_t intVal = value.rep()->data()[0]; + int32_t intVal = value.rep()->characters()[0]; if (intVal < min_num) min_num = intVal; if (intVal > max_num) |
