Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: src/objects-inl.h

Issue 11896060: Correctly reset lastIndex in an RegExp object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 FixedArray* fa = reinterpret_cast<FixedArray*>(data()); 5002 FixedArray* fa = reinterpret_cast<FixedArray*>(data());
5003 if (value->IsSmi()) { 5003 if (value->IsSmi()) {
5004 fa->set_unchecked(index, Smi::cast(value)); 5004 fa->set_unchecked(index, Smi::cast(value));
5005 } else { 5005 } else {
5006 // We only do this during GC, so we don't need to notify the write barrier. 5006 // We only do this during GC, so we don't need to notify the write barrier.
5007 fa->set_unchecked(heap, index, value, SKIP_WRITE_BARRIER); 5007 fa->set_unchecked(heap, index, value, SKIP_WRITE_BARRIER);
5008 } 5008 }
5009 } 5009 }
5010 5010
5011 5011
5012 void JSRegExp::ResetLastIndex() { 5012 void JSRegExp::ResetLastIndex(Isolate* isolate,
5013 InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, 5013 Handle<JSRegExp> regexp) {
5014 Smi::FromInt(0), 5014 // Reset lastIndex property to 0.
5015 SKIP_WRITE_BARRIER); // It's a Smi. 5015 SetProperty(regexp,
5016 isolate->factory()->last_index_symbol(),
5017 Handle<Smi>(Smi::FromInt(0)),
5018 ::NONE,
Sven Panne 2013/01/23 12:16:12 Do we really need to make the top level namespace
5019 kNonStrictMode);
5016 } 5020 }
5017 5021
5018 5022
5019 ElementsKind JSObject::GetElementsKind() { 5023 ElementsKind JSObject::GetElementsKind() {
5020 ElementsKind kind = map()->elements_kind(); 5024 ElementsKind kind = map()->elements_kind();
5021 #if DEBUG 5025 #if DEBUG
5022 FixedArrayBase* fixed_array = 5026 FixedArrayBase* fixed_array =
5023 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); 5027 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
5024 Map* map = fixed_array->map(); 5028 Map* map = fixed_array->map();
5025 ASSERT((IsFastSmiOrObjectElementsKind(kind) && 5029 ASSERT((IsFastSmiOrObjectElementsKind(kind) &&
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5817 #undef WRITE_UINT32_FIELD 5821 #undef WRITE_UINT32_FIELD
5818 #undef READ_SHORT_FIELD 5822 #undef READ_SHORT_FIELD
5819 #undef WRITE_SHORT_FIELD 5823 #undef WRITE_SHORT_FIELD
5820 #undef READ_BYTE_FIELD 5824 #undef READ_BYTE_FIELD
5821 #undef WRITE_BYTE_FIELD 5825 #undef WRITE_BYTE_FIELD
5822 5826
5823 5827
5824 } } // namespace v8::internal 5828 } } // namespace v8::internal
5825 5829
5826 #endif // V8_OBJECTS_INL_H_ 5830 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698