| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 int index) { | 213 int index) { |
| 214 // ----------- S t a t e ------------- | 214 // ----------- S t a t e ------------- |
| 215 // -- lr: return address | 215 // -- lr: return address |
| 216 // ----------------------------------- | 216 // ----------------------------------- |
| 217 | 217 |
| 218 HandleScope scope; | 218 HandleScope scope; |
| 219 Label miss; | 219 Label miss; |
| 220 | 220 |
| 221 const int argc = arguments().immediate(); | 221 const int argc = arguments().immediate(); |
| 222 | 222 |
| 223 // Get the receiver of the function from the stack into r1. | 223 // Get the receiver of the function from the stack into r0. |
| 224 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 224 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
| 225 // Check that the receiver isn't a smi. | 225 // Check that the receiver isn't a smi. |
| 226 __ tst(r1, Operand(kSmiTagMask)); | 226 __ tst(r0, Operand(kSmiTagMask)); |
| 227 __ b(eq, &miss); | 227 __ b(eq, &miss); |
| 228 | 228 |
| 229 // Do the right check and compute the holder register. | 229 // Do the right check and compute the holder register. |
| 230 Register reg = | 230 Register reg = |
| 231 __ CheckMaps(JSObject::cast(object), r1, holder, r3, r2, &miss); | 231 __ CheckMaps(JSObject::cast(object), r0, holder, r3, r2, &miss); |
| 232 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); | 232 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); |
| 233 | 233 |
| 234 // Check that the function really is a function. | 234 // Check that the function really is a function. |
| 235 __ tst(r1, Operand(kSmiTagMask)); | 235 __ tst(r1, Operand(kSmiTagMask)); |
| 236 __ b(eq, &miss); | 236 __ b(eq, &miss); |
| 237 // Get the map. | 237 // Get the map. |
| 238 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 238 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 239 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 239 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
| 240 __ cmp(r2, Operand(JS_FUNCTION_TYPE)); | 240 __ cmp(r2, Operand(JS_FUNCTION_TYPE)); |
| 241 __ b(ne, &miss); | 241 __ b(ne, &miss); |
| 242 | 242 |
| 243 // Patch the receiver on the stack with the global proxy if |
| 244 // necessary. |
| 243 if (object->IsGlobalObject()) { | 245 if (object->IsGlobalObject()) { |
| 244 // TODO(120): Patch receiver with the global proxy. | 246 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
| 247 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
| 245 } | 248 } |
| 246 | 249 |
| 247 // Invoke the function. | 250 // Invoke the function. |
| 248 __ InvokeFunction(r1, arguments(), JUMP_FUNCTION); | 251 __ InvokeFunction(r1, arguments(), JUMP_FUNCTION); |
| 249 | 252 |
| 250 // Handle call cache miss. | 253 // Handle call cache miss. |
| 251 __ bind(&miss); | 254 __ bind(&miss); |
| 252 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 255 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 253 __ Jump(ic, RelocInfo::CODE_TARGET); | 256 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 254 | 257 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 271 // Get the receiver from the stack | 274 // Get the receiver from the stack |
| 272 const int argc = arguments().immediate(); | 275 const int argc = arguments().immediate(); |
| 273 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 276 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 274 | 277 |
| 275 // Check that the receiver isn't a smi. | 278 // Check that the receiver isn't a smi. |
| 276 if (check != NUMBER_CHECK) { | 279 if (check != NUMBER_CHECK) { |
| 277 __ tst(r1, Operand(kSmiTagMask)); | 280 __ tst(r1, Operand(kSmiTagMask)); |
| 278 __ b(eq, &miss); | 281 __ b(eq, &miss); |
| 279 } | 282 } |
| 280 | 283 |
| 284 // Make sure that it's okay not to patch the on stack receiver |
| 285 // unless we're doing a receiver map check. |
| 286 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); |
| 287 |
| 281 switch (check) { | 288 switch (check) { |
| 282 case RECEIVER_MAP_CHECK: | 289 case RECEIVER_MAP_CHECK: |
| 283 // Check that the maps haven't changed. | 290 // Check that the maps haven't changed. |
| 284 __ CheckMaps(JSObject::cast(object), r1, holder, r3, r2, &miss); | 291 __ CheckMaps(JSObject::cast(object), r1, holder, r3, r2, &miss); |
| 292 |
| 293 // Patch the receiver on the stack with the global proxy if |
| 294 // necessary. |
| 295 if (object->IsGlobalObject()) { |
| 296 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
| 297 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
| 298 } |
| 285 break; | 299 break; |
| 286 | 300 |
| 287 case STRING_CHECK: | 301 case STRING_CHECK: |
| 288 // Check that the object is a two-byte string or a symbol. | 302 // Check that the object is a two-byte string or a symbol. |
| 289 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 303 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 290 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 304 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
| 291 __ cmp(r2, Operand(FIRST_NONSTRING_TYPE)); | 305 __ cmp(r2, Operand(FIRST_NONSTRING_TYPE)); |
| 292 __ b(hs, &miss); | 306 __ b(hs, &miss); |
| 293 // Check that the maps starting from the prototype haven't changed. | 307 // Check that the maps starting from the prototype haven't changed. |
| 294 GenerateLoadGlobalFunctionPrototype(masm(), | 308 GenerateLoadGlobalFunctionPrototype(masm(), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 break; | 360 break; |
| 347 | 361 |
| 348 default: | 362 default: |
| 349 UNREACHABLE(); | 363 UNREACHABLE(); |
| 350 } | 364 } |
| 351 | 365 |
| 352 // Get the function and setup the context. | 366 // Get the function and setup the context. |
| 353 __ mov(r1, Operand(Handle<JSFunction>(function))); | 367 __ mov(r1, Operand(Handle<JSFunction>(function))); |
| 354 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 368 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 355 | 369 |
| 356 if (object->IsGlobalObject()) { | |
| 357 // TODO(120): Patch receiver with the global proxy. | |
| 358 } | |
| 359 | |
| 360 // Jump to the cached code (tail call). | 370 // Jump to the cached code (tail call). |
| 361 Handle<Code> code(function->code()); | 371 Handle<Code> code(function->code()); |
| 362 ParameterCount expected(function->shared()->formal_parameter_count()); | 372 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 363 __ InvokeCode(code, expected, arguments(), | 373 __ InvokeCode(code, expected, arguments(), |
| 364 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 374 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 365 | 375 |
| 366 // Handle call cache miss. | 376 // Handle call cache miss. |
| 367 __ bind(&miss); | 377 __ bind(&miss); |
| 368 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 378 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 369 __ Jump(ic, RelocInfo::CODE_TARGET); | 379 __ Jump(ic, RelocInfo::CODE_TARGET); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 String* name) { | 842 String* name) { |
| 833 UNIMPLEMENTED(); | 843 UNIMPLEMENTED(); |
| 834 return Heap::undefined_value(); | 844 return Heap::undefined_value(); |
| 835 } | 845 } |
| 836 | 846 |
| 837 | 847 |
| 838 | 848 |
| 839 #undef __ | 849 #undef __ |
| 840 | 850 |
| 841 } } // namespace v8::internal | 851 } } // namespace v8::internal |
| OLD | NEW |