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

Side by Side Diff: src/api.cc

Issue 16337005: Deprecate FACTORY helper macro. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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/api.h ('k') | src/arm/code-stubs-arm.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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 878
879 // This method cannot easily return an error value, therefore it is necessary 879 // This method cannot easily return an error value, therefore it is necessary
880 // to check for a dead VM with ON_BAILOUT before calling it. To remind you 880 // to check for a dead VM with ON_BAILOUT before calling it. To remind you
881 // about this there is no HandleScope in this method. When you add one to the 881 // about this there is no HandleScope in this method. When you add one to the
882 // site calling this method you should check that you ensured the VM was not 882 // site calling this method you should check that you ensured the VM was not
883 // dead first. 883 // dead first.
884 void NeanderArray::add(i::Handle<i::Object> value) { 884 void NeanderArray::add(i::Handle<i::Object> value) {
885 int length = this->length(); 885 int length = this->length();
886 int size = obj_.size(); 886 int size = obj_.size();
887 if (length == size - 1) { 887 if (length == size - 1) {
888 i::Handle<i::FixedArray> new_elms = FACTORY->NewFixedArray(2 * size); 888 i::Factory* factory = i::Isolate::Current()->factory();
889 i::Handle<i::FixedArray> new_elms = factory->NewFixedArray(2 * size);
889 for (int i = 0; i < length; i++) 890 for (int i = 0; i < length; i++)
890 new_elms->set(i + 1, get(i)); 891 new_elms->set(i + 1, get(i));
891 obj_.value()->set_elements(*new_elms); 892 obj_.value()->set_elements(*new_elms);
892 } 893 }
893 obj_.set(length + 1, *value); 894 obj_.set(length + 1, *value);
894 obj_.set(0, i::Smi::FromInt(length + 1)); 895 obj_.set(0, i::Smi::FromInt(length + 1));
895 } 896 }
896 897
897 898
898 void NeanderArray::set(int index, i::Object* value) { 899 void NeanderArray::set(int index, i::Object* value) {
(...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after
3848 } 3849 }
3849 3850
3850 3851
3851 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { 3852 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
3852 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3853 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3853 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", 3854 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()",
3854 return Local<v8::Value>()); 3855 return Local<v8::Value>());
3855 ENTER_V8(isolate); 3856 ENTER_V8(isolate);
3856 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3857 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3857 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 3858 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3858 i::Handle<i::String> key_string = FACTORY->InternalizeString(key_obj); 3859 i::Handle<i::String> key_string =
3860 isolate->factory()->InternalizeString(key_obj);
3859 i::Handle<i::Object> result(self->GetHiddenProperty(*key_string), isolate); 3861 i::Handle<i::Object> result(self->GetHiddenProperty(*key_string), isolate);
3860 if (result->IsUndefined()) return v8::Local<v8::Value>(); 3862 if (result->IsUndefined()) return v8::Local<v8::Value>();
3861 return Utils::ToLocal(result); 3863 return Utils::ToLocal(result);
3862 } 3864 }
3863 3865
3864 3866
3865 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { 3867 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
3866 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3868 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3867 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false); 3869 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false);
3868 ENTER_V8(isolate); 3870 ENTER_V8(isolate);
3869 i::HandleScope scope(isolate); 3871 i::HandleScope scope(isolate);
3870 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3872 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3871 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 3873 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3872 i::Handle<i::String> key_string = FACTORY->InternalizeString(key_obj); 3874 i::Handle<i::String> key_string =
3875 isolate->factory()->InternalizeString(key_obj);
3873 self->DeleteHiddenProperty(*key_string); 3876 self->DeleteHiddenProperty(*key_string);
3874 return true; 3877 return true;
3875 } 3878 }
3876 3879
3877 3880
3878 namespace { 3881 namespace {
3879 3882
3880 static i::ElementsKind GetElementsKindFromExternalArrayType( 3883 static i::ElementsKind GetElementsKindFromExternalArrayType(
3881 ExternalArrayType array_type) { 3884 ExternalArrayType array_type) {
3882 switch (array_type) { 3885 switch (array_type) {
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
5889 i::Execution::TryCall(func, 5892 i::Execution::TryCall(func,
5890 isolate->js_builtins_object(), 5893 isolate->js_builtins_object(),
5891 0, 5894 0,
5892 NULL, 5895 NULL,
5893 &caught_exception); 5896 &caught_exception);
5894 } 5897 }
5895 } 5898 }
5896 5899
5897 5900
5898 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) { 5901 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) {
5902 i::Isolate* isolate = i::Isolate::Current();
5899 uint8_t flags_buf[3]; 5903 uint8_t flags_buf[3];
5900 int num_flags = 0; 5904 int num_flags = 0;
5901 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g'; 5905 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g';
5902 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; 5906 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm';
5903 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; 5907 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
5904 ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf))); 5908 ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf)));
5905 return FACTORY->InternalizeOneByteString( 5909 return isolate->factory()->InternalizeOneByteString(
5906 i::Vector<const uint8_t>(flags_buf, num_flags)); 5910 i::Vector<const uint8_t>(flags_buf, num_flags));
5907 } 5911 }
5908 5912
5909 5913
5910 Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern, 5914 Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern,
5911 Flags flags) { 5915 Flags flags) {
5912 i::Isolate* isolate = Utils::OpenHandle(*pattern)->GetIsolate(); 5916 i::Isolate* isolate = Utils::OpenHandle(*pattern)->GetIsolate();
5913 EnsureInitializedForIsolate(isolate, "v8::RegExp::New()"); 5917 EnsureInitializedForIsolate(isolate, "v8::RegExp::New()");
5914 LOG_API(isolate, "RegExp::New"); 5918 LOG_API(isolate, "RegExp::New");
5915 ENTER_V8(isolate); 5919 ENTER_V8(isolate);
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
7852 7856
7853 v->VisitPointers(blocks_.first(), first_block_limit_); 7857 v->VisitPointers(blocks_.first(), first_block_limit_);
7854 7858
7855 for (int i = 1; i < blocks_.length(); i++) { 7859 for (int i = 1; i < blocks_.length(); i++) {
7856 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7860 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7857 } 7861 }
7858 } 7862 }
7859 7863
7860 7864
7861 } } // namespace v8::internal 7865 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698