| OLD | NEW | 
|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 208     ASSERT(slot != NULL); | 208     ASSERT(slot != NULL); | 
| 209     if (expr->location().is_temporary()) { | 209     if (expr->location().is_temporary()) { | 
| 210       __ ldr(ip, MemOperand(fp, SlotOffset(slot))); | 210       __ ldr(ip, MemOperand(fp, SlotOffset(slot))); | 
| 211       __ push(ip); | 211       __ push(ip); | 
| 212     } else { | 212     } else { | 
| 213       ASSERT(expr->location().is_nowhere()); | 213       ASSERT(expr->location().is_nowhere()); | 
| 214     } | 214     } | 
| 215   } | 215   } | 
| 216 } | 216 } | 
| 217 | 217 | 
|  | 218 void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 
|  | 219   Comment cmnt(masm_, "[ RegExp Literal"); | 
|  | 220   Label done; | 
|  | 221   // Registers will be used as follows: | 
|  | 222   // r4 = JS function, literals array | 
|  | 223   // r3 = literal index | 
|  | 224   // r2 = RegExp pattern | 
|  | 225   // r1 = RegExp flags | 
|  | 226   // r0 = temp + return value (RegExp literal) | 
|  | 227   __ ldr(r0, MemOperand(fp,  JavaScriptFrameConstants::kFunctionOffset)); | 
|  | 228   __ ldr(r4,  FieldMemOperand(r0, JSFunction::kLiteralsOffset)); | 
|  | 229   int literal_offset = | 
|  | 230     FixedArray::kHeaderSize + expr->literal_index() * kPointerSize; | 
|  | 231   __ ldr(r0, FieldMemOperand(r4, literal_offset)); | 
|  | 232   __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 
|  | 233   __ cmp(r0, ip); | 
|  | 234   __ b(ne, &done); | 
|  | 235   __ mov(r3, Operand(Smi::FromInt(expr->literal_index()))); | 
|  | 236   __ mov(r2, Operand(expr->pattern())); | 
|  | 237   __ mov(r1, Operand(expr->flags())); | 
|  | 238   __ stm(db_w, sp, r4.bit() | r3.bit() | r2.bit() | r1.bit()); | 
|  | 239   __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); | 
|  | 240   __ bind(&done); | 
|  | 241   if (expr->location().is_temporary()) { | 
|  | 242     __ push(r0); | 
|  | 243   } else { | 
|  | 244     ASSERT(expr->location().is_nowhere()); | 
|  | 245   } | 
|  | 246 } | 
| 218 | 247 | 
| 219 void FastCodeGenerator::VisitAssignment(Assignment* expr) { | 248 void FastCodeGenerator::VisitAssignment(Assignment* expr) { | 
| 220   Comment cmnt(masm_, "[ Assignment"); | 249   Comment cmnt(masm_, "[ Assignment"); | 
| 221   ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); | 250   ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); | 
| 222   Expression* rhs = expr->value(); | 251   Expression* rhs = expr->value(); | 
| 223   Visit(rhs); | 252   Visit(rhs); | 
| 224 | 253 | 
| 225   // Left-hand side can only be a global or a (parameter or local) slot. | 254   // Left-hand side can only be a global or a (parameter or local) slot. | 
| 226   Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 255   Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 
| 227   ASSERT(var != NULL); | 256   ASSERT(var != NULL); | 
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 335 | 364 | 
| 336   // Push the arguments ("left-to-right"). | 365   // Push the arguments ("left-to-right"). | 
| 337   int arg_count = args->length(); | 366   int arg_count = args->length(); | 
| 338   for (int i = 0; i < arg_count; i++) { | 367   for (int i = 0; i < arg_count; i++) { | 
| 339     Visit(args->at(i)); | 368     Visit(args->at(i)); | 
| 340     ASSERT(!args->at(i)->location().is_nowhere()); | 369     ASSERT(!args->at(i)->location().is_nowhere()); | 
| 341     if (args->at(i)->location().is_constant()) { | 370     if (args->at(i)->location().is_constant()) { | 
| 342       ASSERT(args->at(i)->AsLiteral() != NULL); | 371       ASSERT(args->at(i)->AsLiteral() != NULL); | 
| 343       __ mov(r0, Operand(args->at(i)->AsLiteral()->handle())); | 372       __ mov(r0, Operand(args->at(i)->AsLiteral()->handle())); | 
| 344       __ push(r0); | 373       __ push(r0); | 
|  | 374     } else { | 
|  | 375       ASSERT(args->at(i)->location().is_temporary()); | 
|  | 376       // If location is temporary, it is already on the stack, | 
|  | 377       // so nothing to do here. | 
| 345     } | 378     } | 
| 346   } | 379   } | 
| 347 | 380 | 
| 348   __ CallRuntime(function, arg_count); | 381   __ CallRuntime(function, arg_count); | 
| 349   if (expr->location().is_temporary()) { | 382   if (expr->location().is_temporary()) { | 
| 350     __ push(r0); | 383     __ push(r0); | 
| 351   } else { | 384   } else { | 
| 352     ASSERT(expr->location().is_nowhere()); | 385     ASSERT(expr->location().is_nowhere()); | 
| 353   } | 386   } | 
| 354 } | 387 } | 
| 355 | 388 | 
| 356 | 389 | 
| 357 } }  // namespace v8::internal | 390 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|