OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 const int argc = this->target()->arguments_count(); | 371 const int argc = this->target()->arguments_count(); |
372 StackFrameLocator locator; | 372 StackFrameLocator locator; |
373 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); | 373 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); |
374 int index = frame->ComputeExpressionsCount() - (argc + 1); | 374 int index = frame->ComputeExpressionsCount() - (argc + 1); |
375 frame->SetExpression(index, *target); | 375 frame->SetExpression(index, *target); |
376 } | 376 } |
377 | 377 |
378 return *delegate; | 378 return *delegate; |
379 } | 379 } |
380 | 380 |
381 void CallIC::ReceiverToObject(Object* object) { | 381 void CallIC::ReceiverToObject(Handle<Object> object) { |
382 HandleScope scope; | 382 HandleScope scope; |
383 Handle<Object> receiver(object); | 383 Handle<Object> receiver(object); |
384 | 384 |
385 // Change the receiver to the result of calling ToObject on it. | 385 // Change the receiver to the result of calling ToObject on it. |
386 const int argc = this->target()->arguments_count(); | 386 const int argc = this->target()->arguments_count(); |
387 StackFrameLocator locator; | 387 StackFrameLocator locator; |
388 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); | 388 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); |
389 int index = frame->ComputeExpressionsCount() - (argc + 1); | 389 int index = frame->ComputeExpressionsCount() - (argc + 1); |
390 frame->SetExpression(index, object->ToObject()); | 390 frame->SetExpression(index, *Factory::ToObject(object)); |
391 } | 391 } |
392 | 392 |
393 | 393 |
394 Object* CallIC::LoadFunction(State state, | 394 Object* CallIC::LoadFunction(State state, |
395 Handle<Object> object, | 395 Handle<Object> object, |
396 Handle<String> name) { | 396 Handle<String> name) { |
397 // If the object is undefined or null it's illegal to try to get any | 397 // If the object is undefined or null it's illegal to try to get any |
398 // of its properties; throw a TypeError in that case. | 398 // of its properties; throw a TypeError in that case. |
399 if (object->IsUndefined() || object->IsNull()) { | 399 if (object->IsUndefined() || object->IsNull()) { |
400 return TypeError("non_object_property_call", object, name); | 400 return TypeError("non_object_property_call", object, name); |
401 } | 401 } |
402 | 402 |
403 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { | 403 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { |
404 ReceiverToObject(*object); | 404 ReceiverToObject(object); |
405 } | 405 } |
406 | 406 |
407 // Check if the name is trivially convertible to an index and get | 407 // Check if the name is trivially convertible to an index and get |
408 // the element if so. | 408 // the element if so. |
409 uint32_t index; | 409 uint32_t index; |
410 if (name->AsArrayIndex(&index)) { | 410 if (name->AsArrayIndex(&index)) { |
411 Object* result = object->GetElement(index); | 411 Object* result = object->GetElement(index); |
412 if (result->IsJSFunction()) return result; | 412 if (result->IsJSFunction()) return result; |
413 | 413 |
414 // Try to find a suitable function delegate for the object at hand. | 414 // Try to find a suitable function delegate for the object at hand. |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 #undef ADDR | 1433 #undef ADDR |
1434 }; | 1434 }; |
1435 | 1435 |
1436 | 1436 |
1437 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1437 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1438 return IC_utilities[id]; | 1438 return IC_utilities[id]; |
1439 } | 1439 } |
1440 | 1440 |
1441 | 1441 |
1442 } } // namespace v8::internal | 1442 } } // namespace v8::internal |
OLD | NEW |