Changeset 34851 in webkit for trunk/JavaScriptCore/VM/Machine.cpp


Ignore:
Timestamp:
Jun 28, 2008, 8:50:49 AM (17 years ago)
Author:
Darin Adler
Message:

2008-06-28 Darin Adler <Darin Adler>

Reviewed by Oliver.

SunSpider says 0.8% faster.

  • VM/CodeBlock.cpp: (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
  • VM/Machine.cpp: (KJS::Machine::privateExecute): Ditto.
  • VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitNewArray): Added.
  • VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
  • kjs/nodes.cpp: (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be initialized with as many elements as possible. If the array doesn't have any holes in it, that's all that's needed. If there are holes, then emit some separate put operations for the other values in the array and for the length as needed.
  • kjs/nodes.h: Added some accessors to ElementNode so the code generator can iterate through elements and generate code to evaluate them. Now ArrayNode does not need to be a friend. Also took out some unused PlacementNewAdoptType constructors.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.cpp

    r34849 r34851  
    3636#include "ExecState.h"
    3737#include "JSActivation.h"
     38#include "JSArray.h"
     39#include "JSFunction.h"
    3840#include "JSLock.h"
    3941#include "JSPropertyNameIterator.h"
     42#include "JSString.h"
    4043#include "Parser.h"
    4144#include "Profiler.h"
     45#include "RegExpObject.h"
    4246#include "Register.h"
    43 #include "JSArray.h"
    4447#include "debugger.h"
    45 #include "JSFunction.h"
    46 #include "JSString.h"
    4748#include "object_object.h"
    4849#include "operations.h"
    49 #include "RegExpObject.h"
    50 
    5150#include <stdio.h>
    5251
     
    10371036    }
    10381037    BEGIN_OPCODE(op_new_array) {
    1039         /* new_array dst(r)
    1040 
    1041            Constructs a new empty Array instance using the original
     1038        /* new_array dst(r) firstArg(r) argCount(n)
     1039
     1040           Constructs a new Array instance using the original
    10421041           constructor, and puts the result in register dst.
    1043         */
    1044         int dst = (++vPC)->u.operand;
    1045         r[dst].u.jsValue = constructEmptyArray(exec);
     1042           The array will contain argCount elements with values
     1043           taken from registers starting at register firstArg.
     1044        */
     1045        int dst = (++vPC)->u.operand;
     1046        int firstArg = (++vPC)->u.operand;
     1047        int argCount = (++vPC)->u.operand;
     1048        ArgList args(reinterpret_cast<JSValue***>(&registerBase), r - registerBase + firstArg, argCount);
     1049        r[dst].u.jsValue = constructArray(exec, args);
    10461050
    10471051        ++vPC;
Note: See TracChangeset for help on using the changeset viewer.