| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 done.Bind(); | 2304 done.Bind(); |
| 2305 // Push the literal. | 2305 // Push the literal. |
| 2306 frame_->EmitPush(r2); | 2306 frame_->EmitPush(r2); |
| 2307 } | 2307 } |
| 2308 | 2308 |
| 2309 | 2309 |
| 2310 // This deferred code stub will be used for creating the boilerplate | 2310 // This deferred code stub will be used for creating the boilerplate |
| 2311 // by calling Runtime_CreateObjectLiteral. | 2311 // by calling Runtime_CreateObjectLiteral. |
| 2312 // Each created boilerplate is stored in the JSFunction and they are | 2312 // Each created boilerplate is stored in the JSFunction and they are |
| 2313 // therefore context dependent. | 2313 // therefore context dependent. |
| 2314 class ObjectLiteralDeferred: public DeferredCode { | 2314 class DeferredObjectLiteral: public DeferredCode { |
| 2315 public: | 2315 public: |
| 2316 ObjectLiteralDeferred(CodeGenerator* generator, ObjectLiteral* node) | 2316 DeferredObjectLiteral(CodeGenerator* generator, ObjectLiteral* node) |
| 2317 : DeferredCode(generator), node_(node) { | 2317 : DeferredCode(generator), node_(node) { |
| 2318 set_comment("[ ObjectLiteralDeferred"); | 2318 set_comment("[ DeferredObjectLiteral"); |
| 2319 } | 2319 } |
| 2320 | 2320 |
| 2321 virtual void Generate(); | 2321 virtual void Generate(); |
| 2322 | 2322 |
| 2323 private: | 2323 private: |
| 2324 ObjectLiteral* node_; | 2324 ObjectLiteral* node_; |
| 2325 }; | 2325 }; |
| 2326 | 2326 |
| 2327 | 2327 |
| 2328 void ObjectLiteralDeferred::Generate() { | 2328 void DeferredObjectLiteral::Generate() { |
| 2329 // Argument is passed in r1. | 2329 // Argument is passed in r1. |
| 2330 enter()->Bind(); | 2330 enter()->Bind(); |
| 2331 VirtualFrame::SpilledScope spilled_scope(generator()); | 2331 VirtualFrame::SpilledScope spilled_scope(generator()); |
| 2332 | 2332 |
| 2333 // If the entry is undefined we call the runtime system to computed | 2333 // If the entry is undefined we call the runtime system to computed |
| 2334 // the literal. | 2334 // the literal. |
| 2335 | 2335 |
| 2336 VirtualFrame* frame = generator()->frame(); | 2336 VirtualFrame* frame = generator()->frame(); |
| 2337 // Literal array (0). | 2337 // Literal array (0). |
| 2338 frame->Push(r1); | 2338 frame->EmitPush(r1); |
| 2339 // Literal index (1). | 2339 // Literal index (1). |
| 2340 __ mov(r0, Operand(Smi::FromInt(node_->literal_index()))); | 2340 __ mov(r0, Operand(Smi::FromInt(node_->literal_index()))); |
| 2341 frame->Push(r0); | 2341 frame->EmitPush(r0); |
| 2342 // Constant properties (2). | 2342 // Constant properties (2). |
| 2343 __ mov(r0, Operand(node_->constant_properties())); | 2343 __ mov(r0, Operand(node_->constant_properties())); |
| 2344 frame->Push(r0); | 2344 frame->EmitPush(r0); |
| 2345 Result boilerplate = | 2345 Result boilerplate = |
| 2346 frame->CallRuntime(Runtime::kCreateObjectLiteralBoilerplate, 3); | 2346 frame->CallRuntime(Runtime::kCreateObjectLiteralBoilerplate, 3); |
| 2347 __ mov(r2, Operand(boilerplate.reg())); | 2347 __ mov(r2, Operand(boilerplate.reg())); |
| 2348 // Result is returned in r2. | 2348 // Result is returned in r2. |
| 2349 exit()->Jump(); | 2349 exit()->Jump(); |
| 2350 } | 2350 } |
| 2351 | 2351 |
| 2352 | 2352 |
| 2353 void CodeGenerator::VisitObjectLiteral(ObjectLiteral* node) { | 2353 void CodeGenerator::VisitObjectLiteral(ObjectLiteral* node) { |
| 2354 VirtualFrame::SpilledScope spilled_scope(this); | 2354 VirtualFrame::SpilledScope spilled_scope(this); |
| 2355 Comment cmnt(masm_, "[ ObjectLiteral"); | 2355 Comment cmnt(masm_, "[ ObjectLiteral"); |
| 2356 | 2356 |
| 2357 ObjectLiteralDeferred* deferred = new ObjectLiteralDeferred(this, node); | 2357 DeferredObjectLiteral* deferred = new DeferredObjectLiteral(this, node); |
| 2358 | 2358 |
| 2359 // Retrieve the literal array and check the allocated entry. | 2359 // Retrieve the literal array and check the allocated entry. |
| 2360 | 2360 |
| 2361 // Load the function of this activation. | 2361 // Load the function of this activation. |
| 2362 __ ldr(r1, frame_->Function()); | 2362 __ ldr(r1, frame_->Function()); |
| 2363 | 2363 |
| 2364 // Load the literals array of the function. | 2364 // Load the literals array of the function. |
| 2365 __ ldr(r1, FieldMemOperand(r1, JSFunction::kLiteralsOffset)); | 2365 __ ldr(r1, FieldMemOperand(r1, JSFunction::kLiteralsOffset)); |
| 2366 | 2366 |
| 2367 // Load the literal at the ast saved index. | 2367 // Load the literal at the ast saved index. |
| (...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4707 __ mov(r2, Operand(0)); | 4707 __ mov(r2, Operand(0)); |
| 4708 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 4708 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
| 4709 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 4709 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
| 4710 RelocInfo::CODE_TARGET); | 4710 RelocInfo::CODE_TARGET); |
| 4711 } | 4711 } |
| 4712 | 4712 |
| 4713 | 4713 |
| 4714 #undef __ | 4714 #undef __ |
| 4715 | 4715 |
| 4716 } } // namespace v8::internal | 4716 } } // namespace v8::internal |
| OLD | NEW |