OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3484 value = JSGlobalPropertyCell::cast(value)->value(); | 3484 value = JSGlobalPropertyCell::cast(value)->value(); |
3485 if (!value->IsTheHole()) return value; | 3485 if (!value->IsTheHole()) return value; |
3486 // If value is the hole do the general lookup. | 3486 // If value is the hole do the general lookup. |
3487 } | 3487 } |
3488 } | 3488 } |
3489 } else if (args[0]->IsString() && args[1]->IsSmi()) { | 3489 } else if (args[0]->IsString() && args[1]->IsSmi()) { |
3490 // Fast case for string indexing using [] with a smi index. | 3490 // Fast case for string indexing using [] with a smi index. |
3491 HandleScope scope; | 3491 HandleScope scope; |
3492 Handle<String> str = args.at<String>(0); | 3492 Handle<String> str = args.at<String>(0); |
3493 int index = Smi::cast(args[1])->value(); | 3493 int index = Smi::cast(args[1])->value(); |
3494 Handle<Object> result = GetCharAt(str, index); | 3494 if (index >= 0 && index < str->length()) { |
Mads Ager (chromium)
2011/02/01 12:02:12
Good catch! Thanks!
Søren Thygesen Gjesse
2011/02/01 12:02:56
Is this a bug-fix? If so maybe there should be a r
danno
2011/02/03 12:53:26
There's actually an existing test case that wasn't
| |
3495 return *result; | 3495 Handle<Object> result = GetCharAt(str, index); |
3496 return *result; | |
3497 } | |
3496 } | 3498 } |
3497 | 3499 |
3498 // Fall back to GetObjectProperty. | 3500 // Fall back to GetObjectProperty. |
3499 return Runtime::GetObjectProperty(args.at<Object>(0), | 3501 return Runtime::GetObjectProperty(args.at<Object>(0), |
3500 args.at<Object>(1)); | 3502 args.at<Object>(1)); |
3501 } | 3503 } |
3502 | 3504 |
3503 | 3505 |
3504 static MaybeObject* Runtime_DefineOrRedefineAccessorProperty(Arguments args) { | 3506 static MaybeObject* Runtime_DefineOrRedefineAccessorProperty(Arguments args) { |
3505 ASSERT(args.length() == 5); | 3507 ASSERT(args.length() == 5); |
(...skipping 7368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10874 } else { | 10876 } else { |
10875 // Handle last resort GC and make sure to allow future allocations | 10877 // Handle last resort GC and make sure to allow future allocations |
10876 // to grow the heap without causing GCs (if possible). | 10878 // to grow the heap without causing GCs (if possible). |
10877 Counters::gc_last_resort_from_js.Increment(); | 10879 Counters::gc_last_resort_from_js.Increment(); |
10878 Heap::CollectAllGarbage(false); | 10880 Heap::CollectAllGarbage(false); |
10879 } | 10881 } |
10880 } | 10882 } |
10881 | 10883 |
10882 | 10884 |
10883 } } // namespace v8::internal | 10885 } } // namespace v8::internal |
OLD | NEW |