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

Side by Side Diff: src/runtime.cc

Issue 215293005: Store i18n meta data in hidden symbols instead of js accessible properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: reland Created 6 years, 8 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/runtime.h ('k') | test/intl/break-iterator/protected-icu-internals.js » ('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 13881 matching lines...) Expand 10 before | Expand all | Expand 10 after
13892 NONE)); 13892 NONE));
13893 output->set(i, *result); 13893 output->set(i, *result);
13894 } 13894 }
13895 13895
13896 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); 13896 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output);
13897 result->set_length(Smi::FromInt(length)); 13897 result->set_length(Smi::FromInt(length));
13898 return *result; 13898 return *result;
13899 } 13899 }
13900 13900
13901 13901
13902 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) {
13903 HandleScope scope(isolate);
13904
13905 ASSERT(args.length() == 1);
13906
13907 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
13908
13909 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false);
13910 Handle<JSObject> obj = Handle<JSObject>::cast(input);
13911
13912 Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
13913 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate);
13914 return isolate->heap()->ToBoolean(!tag->IsTheHole());
13915 }
13916
13917
13918 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) {
13919 HandleScope scope(isolate);
13920
13921 ASSERT(args.length() == 2);
13922
13923 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
13924 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1);
13925
13926 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false);
13927 Handle<JSObject> obj = Handle<JSObject>::cast(input);
13928
13929 Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
13930 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate);
13931 return isolate->heap()->ToBoolean(
13932 tag->IsString() && String::cast(*tag)->Equals(*expected_type));
13933 }
13934
13935
13936 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) {
13937 HandleScope scope(isolate);
13938
13939 ASSERT(args.length() == 3);
13940
13941 CONVERT_ARG_HANDLE_CHECKED(JSObject, input, 0);
13942 CONVERT_ARG_HANDLE_CHECKED(String, type, 1);
13943 CONVERT_ARG_HANDLE_CHECKED(JSObject, impl, 2);
13944
13945 Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
13946 JSObject::SetHiddenProperty(input, marker, type);
13947
13948 marker = isolate->factory()->intl_impl_object_string();
13949 JSObject::SetHiddenProperty(input, marker, impl);
13950
13951 return isolate->heap()->undefined_value();
13952 }
13953
13954
13955 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetImplFromInitializedIntlObject) {
13956 HandleScope scope(isolate);
13957
13958 ASSERT(args.length() == 1);
13959
13960 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
13961
13962 if (!input->IsJSObject()) {
13963 Vector< Handle<Object> > arguments = HandleVector(&input, 1);
13964 Handle<Object> type_error =
13965 isolate->factory()->NewTypeError("not_intl_object", arguments);
13966 return isolate->Throw(*type_error);
13967 }
13968
13969 Handle<JSObject> obj = Handle<JSObject>::cast(input);
13970
13971 Handle<String> marker = isolate->factory()->intl_impl_object_string();
13972 Handle<Object> impl(obj->GetHiddenProperty(*marker), isolate);
13973 if (impl->IsTheHole()) {
13974 Vector< Handle<Object> > arguments = HandleVector(&obj, 1);
13975 Handle<Object> type_error =
13976 isolate->factory()->NewTypeError("not_intl_object", arguments);
13977 return isolate->Throw(*type_error);
13978 }
13979 return *impl;
13980 }
13981
13982
13902 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) { 13983 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) {
13903 HandleScope scope(isolate); 13984 HandleScope scope(isolate);
13904 13985
13905 ASSERT(args.length() == 3); 13986 ASSERT(args.length() == 3);
13906 13987
13907 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); 13988 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0);
13908 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); 13989 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1);
13909 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); 13990 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
13910 13991
13911 Handle<ObjectTemplateInfo> date_format_template = 13992 Handle<ObjectTemplateInfo> date_format_template =
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
15150 } 15231 }
15151 } 15232 }
15152 15233
15153 15234
15154 void Runtime::OutOfMemory() { 15235 void Runtime::OutOfMemory() {
15155 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15236 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15156 UNREACHABLE(); 15237 UNREACHABLE();
15157 } 15238 }
15158 15239
15159 } } // namespace v8::internal 15240 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/intl/break-iterator/protected-icu-internals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698