| OLD | NEW |
| 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 7924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7935 CHECK_EQ(0, buf[3]); | 7935 CHECK_EQ(0, buf[3]); |
| 7936 CHECK_EQ(0, strcmp("def", buf + 4)); | 7936 CHECK_EQ(0, strcmp("def", buf + 4)); |
| 7937 | 7937 |
| 7938 CHECK_EQ(0, str->WriteOneByte(NULL, 0, 0, String::NO_NULL_TERMINATION)); | 7938 CHECK_EQ(0, str->WriteOneByte(NULL, 0, 0, String::NO_NULL_TERMINATION)); |
| 7939 CHECK_EQ(0, str->WriteUtf8(NULL, 0, 0, String::NO_NULL_TERMINATION)); | 7939 CHECK_EQ(0, str->WriteUtf8(NULL, 0, 0, String::NO_NULL_TERMINATION)); |
| 7940 CHECK_EQ(0, str->Write(NULL, 0, 0, String::NO_NULL_TERMINATION)); | 7940 CHECK_EQ(0, str->Write(NULL, 0, 0, String::NO_NULL_TERMINATION)); |
| 7941 } | 7941 } |
| 7942 | 7942 |
| 7943 | 7943 |
| 7944 static void Utf16Helper( | 7944 static void Utf16Helper( |
| 7945 LocalContext& context, | 7945 LocalContext& context, // NOLINT |
| 7946 const char* name, | 7946 const char* name, |
| 7947 const char* lengths_name, | 7947 const char* lengths_name, |
| 7948 int len) { | 7948 int len) { |
| 7949 Local<v8::Array> a = | 7949 Local<v8::Array> a = |
| 7950 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); | 7950 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); |
| 7951 Local<v8::Array> alens = | 7951 Local<v8::Array> alens = |
| 7952 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); | 7952 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); |
| 7953 for (int i = 0; i < len; i++) { | 7953 for (int i = 0; i < len; i++) { |
| 7954 Local<v8::String> string = | 7954 Local<v8::String> string = |
| 7955 Local<v8::String>::Cast(a->Get(i)); | 7955 Local<v8::String>::Cast(a->Get(i)); |
| 7956 Local<v8::Number> expected_len = | 7956 Local<v8::Number> expected_len = |
| 7957 Local<v8::Number>::Cast(alens->Get(i)); | 7957 Local<v8::Number>::Cast(alens->Get(i)); |
| 7958 int length = GetUtf8Length(string); | 7958 int length = GetUtf8Length(string); |
| 7959 CHECK_EQ(static_cast<int>(expected_len->Value()), length); | 7959 CHECK_EQ(static_cast<int>(expected_len->Value()), length); |
| 7960 } | 7960 } |
| 7961 } | 7961 } |
| 7962 | 7962 |
| 7963 | 7963 |
| 7964 static uint16_t StringGet(Handle<String> str, int index) { | 7964 static uint16_t StringGet(Handle<String> str, int index) { |
| 7965 i::Handle<i::String> istring = | 7965 i::Handle<i::String> istring = |
| 7966 v8::Utils::OpenHandle(String::Cast(*str)); | 7966 v8::Utils::OpenHandle(String::Cast(*str)); |
| 7967 return istring->Get(index); | 7967 return istring->Get(index); |
| 7968 } | 7968 } |
| 7969 | 7969 |
| 7970 | 7970 |
| 7971 static void WriteUtf8Helper( | 7971 static void WriteUtf8Helper( |
| 7972 LocalContext& context, | 7972 LocalContext& context, // NOLINT |
| 7973 const char* name, | 7973 const char* name, |
| 7974 const char* lengths_name, | 7974 const char* lengths_name, |
| 7975 int len) { | 7975 int len) { |
| 7976 Local<v8::Array> b = | 7976 Local<v8::Array> b = |
| 7977 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); | 7977 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); |
| 7978 Local<v8::Array> alens = | 7978 Local<v8::Array> alens = |
| 7979 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); | 7979 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); |
| 7980 char buffer[1000]; | 7980 char buffer[1000]; |
| 7981 char buffer2[1000]; | 7981 char buffer2[1000]; |
| 7982 for (int i = 0; i < len; i++) { | 7982 for (int i = 0; i < len; i++) { |
| (...skipping 14714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22697 Local<Script> script = v8::ScriptCompiler::Compile( | 22697 Local<Script> script = v8::ScriptCompiler::Compile( |
| 22698 isolate, &script_source); | 22698 isolate, &script_source); |
| 22699 Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); | 22699 Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); |
| 22700 CHECK(!script_name.IsEmpty()); | 22700 CHECK(!script_name.IsEmpty()); |
| 22701 CHECK(script_name->IsString()); | 22701 CHECK(script_name->IsString()); |
| 22702 String::Utf8Value utf8_name(script_name); | 22702 String::Utf8Value utf8_name(script_name); |
| 22703 CHECK_EQ(url, *utf8_name); | 22703 CHECK_EQ(url, *utf8_name); |
| 22704 int line_number = script->GetUnboundScript()->GetLineNumber(0); | 22704 int line_number = script->GetUnboundScript()->GetLineNumber(0); |
| 22705 CHECK_EQ(13, line_number); | 22705 CHECK_EQ(13, line_number); |
| 22706 } | 22706 } |
| OLD | NEW |